@@ -157,12 +157,12 @@ forTLSKey: (OFTLSKey*)key { id oldObject = of_tlskey_get(key->_key); if (!of_tlskey_set(key->_key, [object retain])) - @throw [OFInvalidArgumentException exceptionWithClass: self - selector: _cmd]; + /* FIXME: Find a better exception */ + @throw [OFInvalidArgumentException exception]; [oldObject release]; } + (id)objectForTLSKey: (OFTLSKey*)key @@ -182,31 +182,31 @@ #endif + (void)sleepForTimeInterval: (double)seconds { if (seconds < 0) - @throw [OFOutOfRangeException exceptionWithClass: self]; + @throw [OFOutOfRangeException exception]; #if defined(HAVE_NANOSLEEP) struct timespec rqtp; rqtp.tv_sec = (time_t)seconds; rqtp.tv_nsec = lrint((seconds - rqtp.tv_sec) * 1000000000); if (rqtp.tv_sec != floor(seconds)) - @throw [OFOutOfRangeException exceptionWithClass: self]; + @throw [OFOutOfRangeException exception]; nanosleep(&rqtp, NULL); #elif !defined(_WIN32) if (seconds > UINT_MAX) - @throw [OFOutOfRangeException exceptionWithClass: self]; + @throw [OFOutOfRangeException exception]; sleep((unsigned int)seconds); usleep((useconds_t)lrint((seconds - floor(seconds)) * 1000000)); #else if (seconds * 1000 > UINT_MAX) - @throw [OFOutOfRangeException exceptionWithClass: self]; + @throw [OFOutOfRangeException exception]; Sleep((unsigned int)(seconds * 1000)); #endif } @@ -299,12 +299,11 @@ - (void)start { if (_running == OF_THREAD_RUNNING) @throw [OFThreadStillRunningException - exceptionWithClass: [self class] - thread: self]; + exceptionWithThread: self]; if (_running == OF_THREAD_WAITING_FOR_JOIN) { of_thread_detach(_thread); [_returnValue release]; } @@ -313,24 +312,20 @@ _running = OF_THREAD_RUNNING; if (!of_thread_new(&_thread, call_main, self)) { [self release]; - @throw [OFThreadStartFailedException - exceptionWithClass: [self class] - thread: self]; + @throw [OFThreadStartFailedException exceptionWithThread: self]; } set_thread_name(self); } - (id)join { if (_running == OF_THREAD_NOT_RUNNING || !of_thread_join(_thread)) - @throw [OFThreadJoinFailedException - exceptionWithClass: [self class] - thread: self]; + @throw [OFThreadJoinFailedException exceptionWithThread: self]; _running = OF_THREAD_NOT_RUNNING; return _returnValue; } @@ -374,12 +369,11 @@ - (void)dealloc { if (_running == OF_THREAD_RUNNING) @throw [OFThreadStillRunningException - exceptionWithClass: [self class] - thread: self]; + exceptionWithThread: self]; /* * We should not be running anymore, but call detach in order to free * the resources. */