-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
85 lines (66 loc) · 3.7 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
What is libthreadar
libthreadar provides C++ classes for manipulating threads and
propagating back exception from thread to parent thread when the
parent calls the join() method
[ same paradygm as what wait() system calls does for a forked ]
[ process to its parent ]
What it is relying on
libthreadar relies on Posix thread for historical reason, this might
change in the future to rely on C++11 thread without any impact on
the API.
Which compiler to use with libthreadar
To propagate exception of any type libthreadar use C++11 specific
construction, so it requires such compiler to be compiled and linked
with.
Why that strange name
libthreadar has been extracted from code initially part of webdar and
also now used by dar and libdar, where from its "dar" ending name.
However this library is not part of webdar, libdar or dar, is
released separately and can be used independently of them.
What the advantages of libthreadar over c++11 or boost thread?
C++11 defines threads as function base operation while libthreadar
defines it as a class base operation. Boost cannot transmit any type
of exception back to a parent thread:
Libthreadar defines a pure virtual class "thread" you have to inherit
your own class from and define just one method that will be run from
a separated thread. So far the difference is tight, right.
But once a thread object is created the correspponding thread is not
run until you call the run() method. It means also that once it has
finished you can run it again without the overhead of passing again
arguments and defining data structure available to that thread.
Doing that way, it is much easier to pass a lot of arguments after
construction time by calling several more simple and readable adhoc
customized methods defined at your will in your inherited class, than
having many arguments to pass to a single call that does also start
the thread execution.
Doing that way also let you define private fields that only the
thread will have access to and thus access in total security and
performance (no mutex required, and so on). You also may provide
methods for your class to interact with the running thread and have
mutex as private field that let the class manage the inter-thread
communications in total transparency to the user of that class.
libthreadar also provides mutex semaphore and other C++ class adapted
to what you can find from Posix thread library, but keep in mind that
current version is very simple (no detached thread, no interface to
scheduler, just threads in there pure simple form...)
Libthreadar has not the pretention to replace boost or any other library or
C++ standard managing threads from C++ code. Is is rather to be seen
as a more convenient and simple way to use thread withing C++ code.
However this project is extensible (this project is open source), any
contribution that has some value is welcome.
Libthreadar Licensing:
Libthreadar is released under the
GNU LESSER GENERAL PUBLIC LICENSE.
For details about this library license see the
COPYING and COPYING.LESSER files.
Download
You can download from github or git at sourceforge but you will need
the auto-tools (automake, autoconf, libtool...) to create the configure
script. You can instead download ready for use source code (having an
the configure script built) from sourceforge:
https://sourceforge.net/projects/libthreadar/files/
You will find signature beside those packages, see the "Authentication"
paragraph at http://dar.linux.free.fr/ for signature validation.
Detailed documentation documentation is available online here
https://libthreadar.sourceforge.net/
it is built from Doxygen comments found in source code.