Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -47,11 +47,13 @@ #import "OFOutOfRangeException.h" #import "OFThreadJoinFailedException.h" #import "OFThreadStartFailedException.h" #import "OFThreadStillRunningException.h" -#import "atomic.h" +#ifdef OF_HAVE_ATOMIC_OPS +# import "atomic.h" +#endif #import "autorelease.h" #import "threading.h" static of_tlskey_t threadSelfKey; static OFThread *mainThread; @@ -325,16 +327,23 @@ return [self retain]; } - (OFRunLoop*)runLoop { +#ifdef OF_HAVE_ATOMIC_OPS if (runLoop == nil) { OFRunLoop *tmp = [[OFRunLoop alloc] init]; if (!of_atomic_cmpswap_ptr((void**)&runLoop, nil, tmp)) [tmp release]; } +#else + @synchronized (self) { + if (runLoop == nil) + runLoop = [[OFRunLoop alloc] init]; + } +#endif return [[runLoop retain] autorelease]; } - (OFString*)name