Mercurial > cpython-lru_cache-weakref
annotate Python/thread_foobar.h @ 84172:e353f64dfd95
importlib.abc.SourceLoader.get_source() was re-raising SyntaxError and
UnicodeDecodeError as ImportError. That was over-reaching the point of
raising ImportError in get_source() (which is to signal the source
code was not found when it should have). Conflating the two exceptions
with ImportError could lead to masking errors with the source which
should be known outside of whether there was an error simply getting
the source to begin with.
| author | Brett Cannon <brett@python.org> |
|---|---|
| date | Sun, 16 Jun 2013 18:05:54 -0400 |
| parents | b36cb4602e21 |
| children |
| 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 |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2 /* |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
3 * Initialization. |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
4 */ |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
5 static void |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
6 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
|
7 { |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 } |
|
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 * Thread support. |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
12 */ |
|
20468
ebfd87e87884
Partial patch from SF #452266, by Jason Petrone.
Guido van Rossum <guido@python.org>
parents:
14375
diff
changeset
|
13 long |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
14 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
|
15 { |
|
61465
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
16 int success = 0; /* init not needed when SOLARIS_THREADS and */ |
|
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
17 /* C_THREADS implemented properly */ |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
18 |
|
61465
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
19 dprintf(("PyThread_start_new_thread called\n")); |
|
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
20 if (!initialized) |
|
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
21 PyThread_init_thread(); |
|
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
22 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
|
23 } |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
24 |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
25 long |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
26 PyThread_get_thread_ident(void) |
|
1651
7e5f97bab1e6
ceval.c: dict of local mapping is now a tuple
Guido van Rossum <guido@python.org>
parents:
1628
diff
changeset
|
27 { |
|
61465
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
28 if (!initialized) |
|
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
29 PyThread_init_thread(); |
|
1651
7e5f97bab1e6
ceval.c: dict of local mapping is now a tuple
Guido van Rossum <guido@python.org>
parents:
1628
diff
changeset
|
30 } |
|
7e5f97bab1e6
ceval.c: dict of local mapping is now a tuple
Guido van Rossum <guido@python.org>
parents:
1628
diff
changeset
|
31 |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
32 void |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
33 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
|
34 { |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
59086
diff
changeset
|
35 dprintf(("PyThread_exit_thread called\n")); |
|
61465
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
36 if (!initialized) |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
59086
diff
changeset
|
37 exit(0); |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
38 } |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
39 |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
40 /* |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
41 * Lock support. |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
42 */ |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
43 PyThread_type_lock |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
44 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
|
45 { |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
46 |
|
61465
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
47 dprintf(("PyThread_allocate_lock called\n")); |
|
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
48 if (!initialized) |
|
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
49 PyThread_init_thread(); |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
50 |
|
61465
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
51 dprintf(("PyThread_allocate_lock() -> %p\n", lock)); |
|
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
52 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
|
53 } |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
54 |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
55 void |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
56 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
|
57 { |
|
61465
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
58 dprintf(("PyThread_free_lock(%p) called\n", lock)); |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
59 } |
|
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
60 |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
61 int |
|
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
62 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
|
63 { |
|
61465
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
64 int success; |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
65 |
|
61465
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
66 dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag)); |
|
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
67 dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success)); |
|
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
68 return success; |
|
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_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
|
73 { |
|
61465
e38335d4df91
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
21766
diff
changeset
|
74 dprintf(("PyThread_release_lock(%p) called\n", lock)); |
|
1628
a9dd2e1ea5c9
Split thread.c into a number of system-specific files.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
75 } |
