if (!tasksInitialized) {
taskCount = 0;
tasksInitialized = 1;
-#if defined(THREADED_RTS) && !defined(MYTASK_USE_TLV)
+#if defined(THREADED_RTS)
+#if !defined(MYTASK_USE_TLV)
newThreadLocalKey(¤tTaskKey);
+#endif
initMutex(&all_tasks_mutex);
#endif
}