Mercurial > cpython-lru_cache-weakref
annotate Python/thread_cthread.h @ 56121:ea697cde6882 3.1
Merged revisions 74881-74885,74888,74891-74895,74900,74905-74906,74931-74932,74934,74941-74942,74944,74956 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r74881 | r.david.murray | 2009-09-17 15:12:49 -0400 (Thu, 17 Sep 2009) | 2 lines
Check in first draft of maintainers.rst.
........
r74882 | eric.smith | 2009-09-17 15:22:30 -0400 (Thu, 17 Sep 2009) | 1 line
Typo.
........
r74883 | mark.dickinson | 2009-09-17 15:37:28 -0400 (Thu, 17 Sep 2009) | 1 line
Add some more module maintainers.
........
r74884 | mark.dickinson | 2009-09-17 15:39:12 -0400 (Thu, 17 Sep 2009) | 1 line
Revert accidental changes to Objects/longobject.c
........
r74885 | mark.dickinson | 2009-09-17 16:20:01 -0400 (Thu, 17 Sep 2009) | 1 line
Add decimal maintainers
........
r74888 | r.david.murray | 2009-09-17 18:10:48 -0400 (Thu, 17 Sep 2009) | 2 lines
Maintainer additions from MAL.
........
r74891 | georg.brandl | 2009-09-17 18:18:01 -0400 (Thu, 17 Sep 2009) | 1 line
Some more maintainers.
........
r74892 | r.david.murray | 2009-09-17 19:23:56 -0400 (Thu, 17 Sep 2009) | 2 lines
Add a couple interest areas for Nick per his request.
........
r74893 | r.david.murray | 2009-09-17 19:43:20 -0400 (Thu, 17 Sep 2009) | 2 lines
Benajmin is also compiler-knowledgeable.
........
r74894 | alexandre.vassalotti | 2009-09-17 20:59:05 -0400 (Thu, 17 Sep 2009) | 2 lines
Added myself to my areas of interest.
........
r74895 | brett.cannon | 2009-09-17 21:03:35 -0400 (Thu, 17 Sep 2009) | 1 line
Add myself to a couple places as maintainer.
........
r74900 | georg.brandl | 2009-09-18 05:06:37 -0400 (Fri, 18 Sep 2009) | 1 line
Add myself in interest areas.
........
r74905 | ezio.melotti | 2009-09-18 05:58:43 -0400 (Fri, 18 Sep 2009) | 1 line
Add myself in interest areas and mark effbot as inactive in winsound
........
r74906 | antoine.pitrou | 2009-09-18 09:15:23 -0400 (Fri, 18 Sep 2009) | 3 lines
Add myself in a couple of places
........
r74931 | r.david.murray | 2009-09-18 17:25:36 -0400 (Fri, 18 Sep 2009) | 5 lines
Add some names gleaned from the "Tracker Archeology" thread
on python-dev from back in February. Also consolidate
the autoconf and makefiles topics into one, and add tracker
and svn/hg topics.
........
r74932 | r.david.murray | 2009-09-18 17:32:16 -0400 (Fri, 18 Sep 2009) | 2 lines
Remove non-committer mistakenly added.
........
r74934 | r.david.murray | 2009-09-18 17:40:30 -0400 (Fri, 18 Sep 2009) | 2 lines
More descriptive/generic name for the svn/hg entry (version control)
........
r74941 | benjamin.peterson | 2009-09-18 18:45:59 -0400 (Fri, 18 Sep 2009) | 1 line
add a new category for myself
........
r74942 | benjamin.peterson | 2009-09-18 18:50:55 -0400 (Fri, 18 Sep 2009) | 1 line
add myself for symtable
........
r74944 | georg.brandl | 2009-09-19 03:39:05 -0400 (Sat, 19 Sep 2009) | 1 line
I would like to maintain the token module!
........
r74956 | r.david.murray | 2009-09-19 14:40:08 -0400 (Sat, 19 Sep 2009) | 3 lines
Add everyone who we know has been a release manager
as a resource for the 'release management' topic.
........
| author | R. David Murray <rdmurray@bitdance.com> |
|---|---|
| date | Sat, 19 Sep 2009 19:04:37 +0000 |
| parents | 8b116a8449bd |
| children | e38335d4df91 df5719c298db |
| rev | line source |
|---|---|
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 |
|
21606
67da11293406
Patch #497098: build support for GNU/Hurd.
Martin v. Löwis <martin@v.loewis.de>
parents:
20468
diff
changeset
|
2 #ifdef MACH_C_THREADS |
|
3838
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
3 #include <mach/cthreads.h> |
|
21606
67da11293406
Patch #497098: build support for GNU/Hurd.
Martin v. Löwis <martin@v.loewis.de>
parents:
20468
diff
changeset
|
4 #endif |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
5 |
|
21606
67da11293406
Patch #497098: build support for GNU/Hurd.
Martin v. Löwis <martin@v.loewis.de>
parents:
20468
diff
changeset
|
6 #ifdef HURD_C_THREADS |
|
67da11293406
Patch #497098: build support for GNU/Hurd.
Martin v. Löwis <martin@v.loewis.de>
parents:
20468
diff
changeset
|
7 #include <cthreads.h> |
|
67da11293406
Patch #497098: build support for GNU/Hurd.
Martin v. Löwis <martin@v.loewis.de>
parents:
20468
diff
changeset
|
8 #endif |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
9 |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
10 /* |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
11 * Initialization. |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
12 */ |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
13 static void |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
14 PyThread__init_thread(void) |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
15 { |
|
21606
67da11293406
Patch #497098: build support for GNU/Hurd.
Martin v. Löwis <martin@v.loewis.de>
parents:
20468
diff
changeset
|
16 #ifndef HURD_C_THREADS |
|
67da11293406
Patch #497098: build support for GNU/Hurd.
Martin v. Löwis <martin@v.loewis.de>
parents:
20468
diff
changeset
|
17 /* Roland McGrath said this should not be used since this is |
|
67da11293406
Patch #497098: build support for GNU/Hurd.
Martin v. Löwis <martin@v.loewis.de>
parents:
20468
diff
changeset
|
18 done while linking to threads */ |
|
67da11293406
Patch #497098: build support for GNU/Hurd.
Martin v. Löwis <martin@v.loewis.de>
parents:
20468
diff
changeset
|
19 cthread_init(); |
|
67da11293406
Patch #497098: build support for GNU/Hurd.
Martin v. Löwis <martin@v.loewis.de>
parents:
20468
diff
changeset
|
20 #else |
|
67da11293406
Patch #497098: build support for GNU/Hurd.
Martin v. Löwis <martin@v.loewis.de>
parents:
20468
diff
changeset
|
21 /* do nothing */ |
|
67da11293406
Patch #497098: build support for GNU/Hurd.
Martin v. Löwis <martin@v.loewis.de>
parents:
20468
diff
changeset
|
22 ; |
|
67da11293406
Patch #497098: build support for GNU/Hurd.
Martin v. Löwis <martin@v.loewis.de>
parents:
20468
diff
changeset
|
23 #endif |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
24 } |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
25 |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
26 /* |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
27 * Thread support. |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
28 */ |
|
20468
ebfd87e87884
Partial patch from SF #452266, by Jason Petrone.
Guido van Rossum <guido@python.org>
parents:
15403
diff
changeset
|
29 long |
|
15403
5b4abceff53d
Fix syntax error. Submitted by Bill Bumgarner. Apparently this is
Guido van Rossum <guido@python.org>
parents:
14375
diff
changeset
|
30 PyThread_start_new_thread(void (*func)(void *), void *arg) |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 { |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 int success = 0; /* init not needed when SOLARIS_THREADS and */ |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
33 /* C_THREADS implemented properly */ |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
34 |
|
9679
877d23bd5bdc
Thanks to Chris Herborth, the thread primitives now have proper Py*
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
35 dprintf(("PyThread_start_new_thread called\n")); |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
36 if (!initialized) |
|
9679
877d23bd5bdc
Thanks to Chris Herborth, the thread primitives now have proper Py*
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
37 PyThread_init_thread(); |
|
3838
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
38 /* looks like solaris detaches the thread to never rejoin |
|
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
39 * so well do it here |
|
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
40 */ |
|
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
41 cthread_detach(cthread_fork((cthread_fn_t) func, arg)); |
|
20468
ebfd87e87884
Partial patch from SF #452266, by Jason Petrone.
Guido van Rossum <guido@python.org>
parents:
15403
diff
changeset
|
42 return success < 0 ? -1 : 0; |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
43 } |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
44 |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
45 long |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
46 PyThread_get_thread_ident(void) |
|
1651
7e5f97bab1e6
ceval.c: dict of local mapping is now a tuple
Guido van Rossum <guido@python.org>
parents:
1629
diff
changeset
|
47 { |
|
7e5f97bab1e6
ceval.c: dict of local mapping is now a tuple
Guido van Rossum <guido@python.org>
parents:
1629
diff
changeset
|
48 if (!initialized) |
|
9679
877d23bd5bdc
Thanks to Chris Herborth, the thread primitives now have proper Py*
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
49 PyThread_init_thread(); |
|
3838
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
50 return (long) cthread_self(); |
|
1651
7e5f97bab1e6
ceval.c: dict of local mapping is now a tuple
Guido van Rossum <guido@python.org>
parents:
1629
diff
changeset
|
51 } |
|
7e5f97bab1e6
ceval.c: dict of local mapping is now a tuple
Guido van Rossum <guido@python.org>
parents:
1629
diff
changeset
|
52 |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
53 static void |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
54 do_PyThread_exit_thread(int no_cleanup) |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
55 { |
|
9679
877d23bd5bdc
Thanks to Chris Herborth, the thread primitives now have proper Py*
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
56 dprintf(("PyThread_exit_thread called\n")); |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
57 if (!initialized) |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
58 if (no_cleanup) |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
59 _exit(0); |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
60 else |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
61 exit(0); |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
62 cthread_exit(0); |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
63 } |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
64 |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
65 void |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
66 PyThread_exit_thread(void) |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
67 { |
|
9679
877d23bd5bdc
Thanks to Chris Herborth, the thread primitives now have proper Py*
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
68 do_PyThread_exit_thread(0); |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
69 } |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
70 |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
71 void |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
72 PyThread__exit_thread(void) |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
73 { |
|
9679
877d23bd5bdc
Thanks to Chris Herborth, the thread primitives now have proper Py*
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
74 do_PyThread_exit_thread(1); |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
75 } |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
76 |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
77 #ifndef NO_EXIT_PROG |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
78 static |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
79 void do_PyThread_exit_prog(int status, int no_cleanup) |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
80 { |
|
9679
877d23bd5bdc
Thanks to Chris Herborth, the thread primitives now have proper Py*
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
81 dprintf(("PyThread_exit_prog(%d) called\n", status)); |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
82 if (!initialized) |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
83 if (no_cleanup) |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
84 _exit(status); |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
85 else |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
86 exit(status); |
|
3838
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
87 if (no_cleanup) |
|
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
88 _exit(status); |
|
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
89 else |
|
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
90 exit(status); |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
91 } |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
92 |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
93 void |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
94 PyThread_exit_prog(int status) |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
95 { |
|
9679
877d23bd5bdc
Thanks to Chris Herborth, the thread primitives now have proper Py*
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
96 do_PyThread_exit_prog(status, 0); |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
97 } |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
98 |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
99 void |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
100 PyThread__exit_prog(int status) |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
101 { |
|
9679
877d23bd5bdc
Thanks to Chris Herborth, the thread primitives now have proper Py*
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
102 do_PyThread_exit_prog(status, 1); |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
103 } |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
104 #endif /* NO_EXIT_PROG */ |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
105 |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
106 /* |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
107 * Lock support. |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
108 */ |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
109 PyThread_type_lock |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
110 PyThread_allocate_lock(void) |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
111 { |
|
3838
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
112 mutex_t lock; |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
113 |
|
9679
877d23bd5bdc
Thanks to Chris Herborth, the thread primitives now have proper Py*
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
114 dprintf(("PyThread_allocate_lock called\n")); |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
115 if (!initialized) |
|
9679
877d23bd5bdc
Thanks to Chris Herborth, the thread primitives now have proper Py*
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
116 PyThread_init_thread(); |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
117 |
|
3838
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
118 lock = mutex_alloc(); |
|
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
119 if (mutex_init(lock)) { |
|
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
120 perror("mutex_init"); |
|
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
121 free((void *) lock); |
|
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
122 lock = 0; |
|
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
123 } |
|
13210
ff243b0f16ee
Trent Mick <trentm@activestate.com>:
Fred Drake <fdrake@acm.org>
parents:
9679
diff
changeset
|
124 dprintf(("PyThread_allocate_lock() -> %p\n", lock)); |
|
9679
877d23bd5bdc
Thanks to Chris Herborth, the thread primitives now have proper Py*
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
125 return (PyThread_type_lock) lock; |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
126 } |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
127 |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
128 void |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
129 PyThread_free_lock(PyThread_type_lock lock) |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
130 { |
|
13210
ff243b0f16ee
Trent Mick <trentm@activestate.com>:
Fred Drake <fdrake@acm.org>
parents:
9679
diff
changeset
|
131 dprintf(("PyThread_free_lock(%p) called\n", lock)); |
|
3838
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
132 mutex_free(lock); |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
133 } |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
134 |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
135 int |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
136 PyThread_acquire_lock(PyThread_type_lock lock, int waitflag) |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
137 { |
|
3838
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
138 int success = FALSE; |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
139 |
|
13210
ff243b0f16ee
Trent Mick <trentm@activestate.com>:
Fred Drake <fdrake@acm.org>
parents:
9679
diff
changeset
|
140 dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag)); |
|
3838
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
141 if (waitflag) { /* blocking */ |
|
21606
67da11293406
Patch #497098: build support for GNU/Hurd.
Martin v. Löwis <martin@v.loewis.de>
parents:
20468
diff
changeset
|
142 mutex_lock((mutex_t)lock); |
|
3838
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
143 success = TRUE; |
|
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
144 } else { /* non blocking */ |
|
21606
67da11293406
Patch #497098: build support for GNU/Hurd.
Martin v. Löwis <martin@v.loewis.de>
parents:
20468
diff
changeset
|
145 success = mutex_try_lock((mutex_t)lock); |
|
3838
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
146 } |
|
13210
ff243b0f16ee
Trent Mick <trentm@activestate.com>:
Fred Drake <fdrake@acm.org>
parents:
9679
diff
changeset
|
147 dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success)); |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
148 return success; |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
149 } |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
150 |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
151 void |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
152 PyThread_release_lock(PyThread_type_lock lock) |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
153 { |
|
13210
ff243b0f16ee
Trent Mick <trentm@activestate.com>:
Fred Drake <fdrake@acm.org>
parents:
9679
diff
changeset
|
154 dprintf(("PyThread_release_lock(%p) called\n", lock)); |
|
3838
5aab3f668e84
Changes needed by NeXT (the only platform that seems to use this).
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
155 mutex_unlock((mutex_t )lock); |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
156 } |
