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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
PTHREADS-WIN32
==============
Pthreads-win32 is free software, distributed under the GNU Library
General Public License (LGPL). See the file 'COPYING.LIB' for terms
and conditions.
Mailing list
------------
There is a mailing list for discussing pthreads on Win32. To join, send email
to:
pthreads-win32-subscribe@sources.redhat.com
Unsubscribe by sending mail to:
pthreads-win32-unsubscribe@sources.redhat.com
Acknowledgements
----------------
Pthreads-win32 is based substantially on a Win32 Pthreads implementation
contributed by John E. Bossom <jebossom@cognos.com>. Many others
have contributed important new code and bug fixes.
See the 'CONTRIBUTORS' file for the list of contributors.
Known bugs in this snapshot
---------------------------
1. Running the test "join1.c" with the library built with Mingw32
and the GNUmakefile included, the test fails with a segmentation (invalid
page access) exception. The fault appears to be in the assembler code
emmitted by the compiler [to handle exception contexts] at the
end of the try block in _pthread_threadStart().
2. There are problems with using the libpthread32.a file derived
from the VC++ SEH version of pthread.dll. You may have to wait until
bug(1.) is fixed.
3. I have not been able to build with VC++ using C++ EH. This is a
maintainer problem who doesn't know how to do it. Consequently
there may also be basic parser errors and warnings to be cleaned
up in the code.
4. Due to what is believed to be C++ compliance error in VC++,
if your application contains catch(...) blocks in your POSIX threads
then you will need to replace the "catch(...)" with the macro
"PtW32Catch", eg.
#ifdef PtW32Catch
PtW32Catch {
...
}
#else
catch(...) {
...
}
#endif
Otherwise neither pthreads cancelation nor pthread_exit() will work
reliably.
Building under Mingw32
----------------------
pthread.dll can be built with the current development version of mingw32.
Run "make" in the soruce directory (uses GNUmakefile). This builds
pthread.dll and libpthread32.a.
You can run the testsuite by changing to the "tests" directory and
running "make clean" and then "make". See the "Known bugs" section above.
Building under VC++ using SEH
-----------------------------
From the source directory run "nmake". This builds pthread.dll and
pthread.lib.
You can run the testsuite by changing to the "tests" directory and
running "nmake clean" and then "nmake".
Why you cannot build the library with Cygwin yet
------------------------------------------------
The DLL pthread.dll still cannot be built using g++ due to non thread-safe
exception handling in g++. Thanks to Kevin Ruland for researching this
one. See the FAQ Question 2 for more information.
However, you can use the export library libpthread32.a built under
Mingw32 (not tested under Cygwin) together with the pthread.dll built
with MSVC. Thanks to Anders Norlander for pointing this out.
For convenience, the following pre-built files can be downloaded from
the FTP site (see under "Availability" below):
pthread.h
semaphore.h
sched.h
pthread.dll - built with MSVC cl compiler
pthread.lib - built with MSVC cl compiler
libpthread32.a - built with Mingw32 (use with MSVC pthread.dll)
With these files in the same directory as your application myapp.c,
you could compile, link and run myapp.c under Mingw32 as follows:
gcc -o myapp.exe myapp.c -I. -L. -lpthread32
myapp
Or put pthread.dll in an appropriate directory in your PATH,
put libpthread32.a in MINGW_ROOT\i386-mingw32\lib, and
put pthread.h in MINGW_ROOT\i386-mingw32\include, then use:
gcc -o myapp.exe myapp.c -lpthread32
myapp
Availability
------------
The complete source code in either unbundled, self-extracting
Zip file, or tar/gzipped format can be found at:
ftp://sources.redhat.com/pub/pthreads-win32
The pre-built DLL, export libraries and matching pthread.h can be found at:
ftp://sources.redhat.com/pub/pthreads-win32/dll-latest
Home page:
http://sources.redhat.com/pthreads-win32/
----
Ross Johnson
<rpj@ise.canberra.edu.au>
|