locking tweak

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31210 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2010-08-30 19:16:30 +00:00
parent df44085cad
commit 9d29a2cc48

View file

@ -919,11 +919,17 @@ static void *nsthreadLauncher(void* thread)
NSLog(@"Set event failed - %@", [NSError _last]); NSLog(@"Set event failed - %@", [NSError _last]);
} }
#else #else
/* The write could concievably fail if the pipe is full, but in that /* The write could concievably fail if the pipe is full.
* case we don't care since the other thread should be woken to handle * In that case we need to release the lock teporarily to allow the other
* reading anyway. * thread to consume data from the pipe. It's possible that the thread
* and its runloop might stop during that ... so we need to check that
* outputFd is still valid.
*/ */
write(outputFd, "0", 1); while (outputFd >= 0 && write(outputFd, "0", 1) != 1)
{
[lock unlock];
[lock lock];
}
#endif #endif
[lock unlock]; [lock unlock];
} }