summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Python/thread_cthread.h6
-rw-r--r--Python/thread_foobar.h6
-rw-r--r--Python/thread_lwp.h14
-rw-r--r--Python/thread_pthread.h11
-rw-r--r--Python/thread_sgi.h5
-rw-r--r--Python/thread_solaris.h7
6 files changed, 43 insertions, 6 deletions
diff --git a/Python/thread_cthread.h b/Python/thread_cthread.h
index c56bf0d959..bf9a0249eb 100644
--- a/Python/thread_cthread.h
+++ b/Python/thread_cthread.h
@@ -48,6 +48,12 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
return success < 0 ? 0 : 1;
}
+long get_thread_ident _P0()
+{
+ if (!initialized)
+ init_thread();
+}
+
static void do_exit_thread _P1(no_cleanup, int no_cleanup)
{
dprintf(("exit_thread called\n"));
diff --git a/Python/thread_foobar.h b/Python/thread_foobar.h
index 492096aa68..4b767b1e95 100644
--- a/Python/thread_foobar.h
+++ b/Python/thread_foobar.h
@@ -43,6 +43,12 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
return success < 0 ? 0 : 1;
}
+long get_thread_ident _P0()
+{
+ if (!initialized)
+ init_thread();
+}
+
static void do_exit_thread _P1(no_cleanup, int no_cleanup)
{
dprintf(("exit_thread called\n"));
diff --git a/Python/thread_lwp.h b/Python/thread_lwp.h
index b28e602d93..ab59ccd274 100644
--- a/Python/thread_lwp.h
+++ b/Python/thread_lwp.h
@@ -52,9 +52,7 @@ static void _init_thread _P0()
int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
{
thread_t tid;
- int success = 0; /* init not needed when SOLARIS_THREADS and */
- /* C_THREADS implemented properly */
-
+ int success;
dprintf(("start_new_thread called\n"));
if (!initialized)
init_thread();
@@ -62,6 +60,16 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
return success < 0 ? 0 : 1;
}
+long get_thread_ident _P0()
+{
+ thread_t tid;
+ if (!initialized)
+ init_thread();
+ if (lwp_self(&tid) < 0)
+ return -1;
+ return tid.thread_id;
+}
+
static void do_exit_thread _P1(no_cleanup, int no_cleanup)
{
dprintf(("exit_thread called\n"));
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
index 1d539eea63..c5d7be4d88 100644
--- a/Python/thread_pthread.h
+++ b/Python/thread_pthread.h
@@ -83,9 +83,7 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
static int local_initialized = 0;
#endif /* SGI_THREADS and USE_DL */
pthread_t th;
- int success = 0; /* init not needed when SOLARIS_THREADS and */
- /* C_THREADS implemented properly */
-
+ int success;
dprintf(("start_new_thread called\n"));
if (!initialized)
init_thread();
@@ -93,6 +91,13 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
return success < 0 ? 0 : 1;
}
+long get_thread_ident _P0()
+{
+ if (!initialized)
+ init_thread();
+ return (long) pthread_self();
+}
+
static void do_exit_thread _P1(no_cleanup, int no_cleanup)
{
dprintf(("exit_thread called\n"));
diff --git a/Python/thread_sgi.h b/Python/thread_sgi.h
index 6f6334e534..40f28a0468 100644
--- a/Python/thread_sgi.h
+++ b/Python/thread_sgi.h
@@ -229,6 +229,11 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
return success < 0 ? 0 : 1;
}
+long get_thread_ident _P0()
+{
+ return getpid();
+}
+
static void do_exit_thread _P1(no_cleanup, int no_cleanup)
{
dprintf(("exit_thread called\n"));
diff --git a/Python/thread_solaris.h b/Python/thread_solaris.h
index 08cf6dd051..8bbbeb09da 100644
--- a/Python/thread_solaris.h
+++ b/Python/thread_solaris.h
@@ -76,6 +76,13 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
return success < 0 ? 0 : 1;
}
+long get_thread_ident _P0()
+{
+ if (!initialized)
+ init_thread();
+ return thr_self();
+}
+
static void do_exit_thread _P1(no_cleanup, int no_cleanup)
{
dprintf(("exit_thread called\n"));