@@ -7,42 +7,34 @@ * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ -#ifndef _WIN32 -#include -#else -#include -#endif - #import "OFObject.h" + +#import "threading.h" /** * A Thread Local Storage key. */ @interface OFTLSKey: OFObject { @public -#ifndef _WIN32 - pthread_key_t key; -#else - DWORD key; -#endif + of_tlskey_t key; } /** * \param destructor A destructor that is called when the thread is terminated * \return A new autoreleased Thread Local Storage key */ -+ tlsKeyWithDestructor: (void(*)(void*))destructor; ++ tlsKeyWithDestructor: (void(*)(id))destructor; /** * \param destructor A destructor that is called when the thread is terminated * \return An initialized Thread Local Storage key */ -- initWithDestructor: (void(*)(void*))destructor; +- initWithDestructor: (void(*)(id))destructor; @end /** * The OFThread class provides portable threads. * @@ -50,18 +42,14 @@ * main. */ @interface OFThread: OFObject { id object; -#ifndef _WIN32 - pthread_t thread; -#else - HANDLE thread; + of_thread_t thread; @public id retval; -#endif } /** * \param obj An object that is passed to the main method as a copy or nil * \return A new autoreleased thread @@ -115,15 +103,11 @@ /** * A class for creating mutual exclusions. */ @interface OFMutex: OFObject { -#ifndef _WIN32 - pthread_mutex_t mutex; -#else - CRITICAL_SECTION mutex; -#endif + of_mutex_t mutex; } /** * \return A new autoreleased mutex. */