Index: src/OFTLSKey.h ================================================================== --- src/OFTLSKey.h +++ src/OFTLSKey.h @@ -45,11 +45,12 @@ + (instancetype)TLSKey; /*! * @brief Creates a new Thread Local Storage key with the specified destructor. * - * @param destructor A destructor that is called when the thread is terminated + * @param destructor A destructor that is called when a thread is terminated. + * The argument for the destructor is the TLS key. * @return A new autoreleased Thread Local Storage key */ + (instancetype)TLSKeyWithDestructor: (void(*)(id))destructor; + (void)OF_callAllDestructors; @@ -56,10 +57,11 @@ /*! * @brief Initializes an already allocated Thread Local Storage Key with the * specified destructor. * - * @param destructor A destructor that is called when the thread is terminated + * @param destructor A destructor that is called when a thread is terminated. + * The argument for the destructor is the TLS key. * @return An initialized Thread Local Storage key */ - initWithDestructor: (void(*)(id))destructor; @end Index: src/OFThread.h ================================================================== --- src/OFThread.h +++ src/OFThread.h @@ -111,16 +111,19 @@ */ + (void)setObject: (id)object forTLSKey: (OFTLSKey*)key; /*! - * @brief Returns the object for the specified Thread Local Storage key. + * @brief Returns the object for the specified Thread Local Storage key or nil + * if the key does not exist. * * @warning The returned object is *not* retained and autoreleased for * performance reasons! * * @param key The Thread Local Storage key + * @return The object for the specified Thread Local Storage key or nil if the + * key does not exist. */ + (id)objectForTLSKey: (OFTLSKey*)key; /*! * @brief Returns the current thread.