Fix race condition

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28298 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2009-05-24 04:22:09 +00:00
parent 1bf97bc92e
commit cc3838db4d
2 changed files with 11 additions and 1 deletions

View file

@ -1057,7 +1057,12 @@ GSRunLoopInfoForThread(NSThread *aThread)
}
if (((NSThread_ivars*)aThread)->_runLoopInfo == nil)
{
((NSThread_ivars*)aThread)->_runLoopInfo = [GSRunLoopThreadInfo new];
[gnustep_global_lock lock];
if (((NSThread_ivars*)aThread)->_runLoopInfo == nil)
{
((NSThread_ivars*)aThread)->_runLoopInfo = [GSRunLoopThreadInfo new];
}
[gnustep_global_lock unlock];
}
info = ((NSThread_ivars*)aThread)->_runLoopInfo;
return info;