Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e944da8

Browse files
committed
ceval.c: dict of local mapping is now a tuple
compile.c: lists and dictionary in code objects become tuples import.c: bump MAGIC thread*.[ch]: added thread_ident() function version.c: added '++' to version number and bumped date
1 parent 34162a1 commit e944da8

6 files changed

Lines changed: 43 additions & 6 deletions

File tree

Python/thread_cthread.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
4848
return success < 0 ? 0 : 1;
4949
}
5050

51+
long get_thread_ident _P0()
52+
{
53+
if (!initialized)
54+
init_thread();
55+
}
56+
5157
static void do_exit_thread _P1(no_cleanup, int no_cleanup)
5258
{
5359
dprintf(("exit_thread called\n"));

Python/thread_foobar.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
4343
return success < 0 ? 0 : 1;
4444
}
4545

46+
long get_thread_ident _P0()
47+
{
48+
if (!initialized)
49+
init_thread();
50+
}
51+
4652
static void do_exit_thread _P1(no_cleanup, int no_cleanup)
4753
{
4854
dprintf(("exit_thread called\n"));

Python/thread_lwp.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,24 @@ static void _init_thread _P0()
5252
int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
5353
{
5454
thread_t tid;
55-
int success = 0; /* init not needed when SOLARIS_THREADS and */
56-
/* C_THREADS implemented properly */
57-
55+
int success;
5856
dprintf(("start_new_thread called\n"));
5957
if (!initialized)
6058
init_thread();
6159
success = lwp_create(&tid, func, MINPRIO, 0, lwp_newstk(), 1, arg);
6260
return success < 0 ? 0 : 1;
6361
}
6462

63+
long get_thread_ident _P0()
64+
{
65+
thread_t tid;
66+
if (!initialized)
67+
init_thread();
68+
if (lwp_self(&tid) < 0)
69+
return -1;
70+
return tid.thread_id;
71+
}
72+
6573
static void do_exit_thread _P1(no_cleanup, int no_cleanup)
6674
{
6775
dprintf(("exit_thread called\n"));

Python/thread_pthread.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,21 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
8383
static int local_initialized = 0;
8484
#endif /* SGI_THREADS and USE_DL */
8585
pthread_t th;
86-
int success = 0; /* init not needed when SOLARIS_THREADS and */
87-
/* C_THREADS implemented properly */
88-
86+
int success;
8987
dprintf(("start_new_thread called\n"));
9088
if (!initialized)
9189
init_thread();
9290
success = pthread_create(&th, pthread_attr_default, func, arg);
9391
return success < 0 ? 0 : 1;
9492
}
9593

94+
long get_thread_ident _P0()
95+
{
96+
if (!initialized)
97+
init_thread();
98+
return (long) pthread_self();
99+
}
100+
96101
static void do_exit_thread _P1(no_cleanup, int no_cleanup)
97102
{
98103
dprintf(("exit_thread called\n"));

Python/thread_sgi.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
229229
return success < 0 ? 0 : 1;
230230
}
231231

232+
long get_thread_ident _P0()
233+
{
234+
return getpid();
235+
}
236+
232237
static void do_exit_thread _P1(no_cleanup, int no_cleanup)
233238
{
234239
dprintf(("exit_thread called\n"));

Python/thread_solaris.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
7676
return success < 0 ? 0 : 1;
7777
}
7878

79+
long get_thread_ident _P0()
80+
{
81+
if (!initialized)
82+
init_thread();
83+
return thr_self();
84+
}
85+
7986
static void do_exit_thread _P1(no_cleanup, int no_cleanup)
8087
{
8188
dprintf(("exit_thread called\n"));

0 commit comments

Comments
 (0)