Commit | Line | Data |
---|---|---|
959f3c4c JH |
1 | ?RCS: $Id: d_pthrattrj.U,v $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 1998 Jarkko Hietaniemi | |
4 | ?RCS: | |
5 | ?RCS: You may distribute under the terms of either the GNU General Public | |
6 | ?RCS: License or the Artistic License, as specified in the README file. | |
7 | ?RCS: | |
8 | ?MAKE:d_old_pthread_create_joinable old_pthread_create_joinable: \ | |
9 | cat Compile rm Setvar usethreads i_pthread | |
10 | ?MAKE: -pick add $@ %< | |
11 | ?S:d_old_pthread_create_joinable: | |
12 | ?S: This variable conditionally defines pthread_create_joinable. | |
13 | ?S: undef if pthread.h defines PTHREAD_CREATE_JOINABLE. | |
14 | ?S:. | |
15 | ?S:old_pthread_create_joinable: | |
16 | ?S: This variable defines the constant to use for creating joinable | |
17 | ?S: (aka undetached) pthreads. Unused if pthread.h defines | |
18 | ?S: PTHREAD_CREATE_JOINABLE. If used, possible values are | |
19 | ?S: PTHREAD_CREATE_UNDETACHED and __UNDETACHED. | |
20 | ?S:. | |
21 | ?C:OLD_PTHREAD_CREATE_JOINABLE: | |
22 | ?C: This symbol, if defined, indicates how to create pthread | |
23 | ?C: in joinable (aka undetached) state. NOTE: not defined | |
24 | ?C: if pthread.h already has defined PTHREAD_CREATE_JOINABLE | |
25 | ?C: (the new version of the constant). | |
26 | ?C: If defined, known values are PTHREAD_CREATE_UNDETACHED | |
27 | ?C: and __UNDETACHED. | |
28 | ?C:. | |
29 | ?H:#$d_old_pthread_create_joinable OLD_PTHREAD_CREATE_JOINABLE $old_pthread_create_joinable /**/ | |
30 | ?H:. | |
31 | ?LINT: set d_old_pthread_create_joinable | |
32 | ?LINT: set old_pthread_create_joinable | |
33 | : how to create joinable pthreads | |
34 | if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then | |
35 | echo " " | |
36 | echo "Checking what constant to use for creating joinable pthreads..." >&4 | |
37 | $cat >try.c <<'EOCP' | |
38 | #include <pthread.h> | |
39 | int main() { | |
40 | int detachstate = JOINABLE; | |
41 | } | |
42 | EOCP | |
43 | set try -DJOINABLE=PTHREAD_CREATE_JOINABLE | |
44 | if eval $compile; then | |
45 | echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4 | |
46 | val="$undef" # Yes, undef. | |
47 | set d_old_pthread_create_joinable | |
48 | eval $setvar | |
49 | val="" | |
50 | set old_pthread_create_joinable | |
51 | eval $setvar | |
52 | else | |
53 | set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED | |
54 | if eval $compile; then | |
55 | echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4 | |
56 | val="$define" | |
57 | set d_old_pthread_create_joinable | |
58 | eval $setvar | |
59 | val=PTHREAD_CREATE_UNDETACHED | |
60 | set old_pthread_create_joinable | |
61 | eval $setvar | |
62 | else | |
63 | set try -DJOINABLE=__UNDETACHED | |
64 | if eval $compile; then | |
65 | echo "You seem to use __UNDETACHED." >&4 | |
66 | val="$define" | |
67 | set d_old_pthread_create_joinable | |
68 | eval $setvar | |
69 | val=__UNDETACHED | |
70 | set old_pthread_create_joinable | |
71 | eval $setvar | |
72 | else | |
73 | echo "Egads, nothing obvious found. Guessing that you use 0." >&4 | |
74 | val="$define" | |
75 | set d_old_pthread_create_joinable | |
76 | eval $setvar | |
77 | val=0 | |
78 | set old_pthread_create_joinable | |
79 | eval $setvar | |
80 | fi | |
81 | fi | |
82 | fi | |
83 | $rm -f try try.* | |
84 | else | |
85 | d_old_pthread_create_joinable="$undef" | |
86 | old_pthread_create_joinable="" | |
87 | fi | |
88 |