mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-26 18:21:04 +00:00
Improved locking of initialization of gnustep_system_root, etc
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9676 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e7f9a801ed
commit
63b766f23f
1 changed files with 23 additions and 18 deletions
|
@ -392,7 +392,7 @@ NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directoryKey,
|
||||||
NSString *path;
|
NSString *path;
|
||||||
unsigned i, count;
|
unsigned i, count;
|
||||||
|
|
||||||
if (gnustep_user_root == nil)
|
if (gnustep_system_root == nil)
|
||||||
{
|
{
|
||||||
NS_DURING
|
NS_DURING
|
||||||
{
|
{
|
||||||
|
@ -400,6 +400,9 @@ NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directoryKey,
|
||||||
|
|
||||||
[gnustep_global_lock lock];
|
[gnustep_global_lock lock];
|
||||||
|
|
||||||
|
/* Double-Locking Pattern */
|
||||||
|
if (gnustep_system_root == nil)
|
||||||
|
{
|
||||||
env = [[NSProcessInfo processInfo] environment];
|
env = [[NSProcessInfo processInfo] environment];
|
||||||
/* Any of the following might be nil */
|
/* Any of the following might be nil */
|
||||||
gnustep_system_root = [env objectForKey: @"GNUSTEP_SYSTEM_ROOT"];
|
gnustep_system_root = [env objectForKey: @"GNUSTEP_SYSTEM_ROOT"];
|
||||||
|
@ -416,10 +419,12 @@ NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directoryKey,
|
||||||
}
|
}
|
||||||
gnustep_local_root = [env objectForKey: @"GNUSTEP_LOCAL_ROOT"];
|
gnustep_local_root = [env objectForKey: @"GNUSTEP_LOCAL_ROOT"];
|
||||||
TEST_RETAIN (gnustep_local_root);
|
TEST_RETAIN (gnustep_local_root);
|
||||||
gnustep_network_root = [env objectForKey: @"GNUSTEP_NETWORK_ROOT"];
|
gnustep_network_root = [env objectForKey:
|
||||||
|
@"GNUSTEP_NETWORK_ROOT"];
|
||||||
TEST_RETAIN (gnustep_network_root);
|
TEST_RETAIN (gnustep_network_root);
|
||||||
gnustep_user_root = [env objectForKey: @"GNUSTEP_USER_ROOT"];
|
gnustep_user_root = [env objectForKey: @"GNUSTEP_USER_ROOT"];
|
||||||
TEST_RETAIN (gnustep_user_root);
|
TEST_RETAIN (gnustep_user_root);
|
||||||
|
}
|
||||||
|
|
||||||
[gnustep_global_lock unlock];
|
[gnustep_global_lock unlock];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue