Windows: use a thread-local variable for myTask()
authorSimon Marlow <marlowsd@gmail.com>
Wed, 15 Sep 2010 12:06:27 +0000 (12:06 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Wed, 15 Sep 2010 12:06:27 +0000 (12:06 +0000)
Which entailed fixing an incorrect #ifdef in Task.c

rts/Task.c
rts/Task.h

index 8a289be..e93d60d 100644 (file)
@@ -63,8 +63,10 @@ initTaskManager (void)
     if (!tasksInitialized) {
        taskCount = 0;
        tasksInitialized = 1;
-#if defined(THREADED_RTS) && !defined(MYTASK_USE_TLV)
+#if defined(THREADED_RTS)
+#if !defined(MYTASK_USE_TLV)
        newThreadLocalKey(&currentTaskKey);
+#endif
         initMutex(&all_tasks_mutex);
 #endif
     }
index f91872f..566c042 100644 (file)
@@ -233,8 +233,9 @@ void startWorkerTask (Capability *cap);
 // A thread-local-storage key that we can use to get access to the
 // current thread's Task structure.
 #if defined(THREADED_RTS)
-#if defined(linux_HOST_OS) && \
-    (defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH))
+#if (defined(linux_HOST_OS) && \
+     (defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH))) || \
+    (defined(mingw32_HOST_OS) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
 #define MYTASK_USE_TLV
 extern __thread Task *my_task;
 #else