diff Python/thread_nt.h @ 64844:8e428b8e7d81

issue 9786 Native TLS support for pthreads PyThread_create_key now has a failure mode that the applicatino can detect.
author Kristján Valur Jónsson <kristjan@ccpgames.com>
date Mon, 20 Sep 2010 02:11:49 +0000
parents cab14be0ada1
children b750c45a772c
line wrap: on
line diff
--- a/Python/thread_nt.h	Mon Sep 20 01:33:21 2010 +0000
+++ b/Python/thread_nt.h	Mon Sep 20 02:11:49 2010 +0000
@@ -315,7 +315,10 @@
 int
 PyThread_create_key(void)
 {
-    return (int) TlsAlloc();
+    DWORD result= TlsAlloc();
+    if (result == TLS_OUT_OF_INDEXES)
+        return -1;
+    return (int)result;
 }
 
 void