diff options
Diffstat (limited to 'pr/src/misc/prenv.c')
-rw-r--r-- | pr/src/misc/prenv.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/pr/src/misc/prenv.c b/pr/src/misc/prenv.c index b6b36fad..716e1d5f 100644 --- a/pr/src/misc/prenv.c +++ b/pr/src/misc/prenv.c @@ -25,14 +25,16 @@ #define _PR_LOCK_ENV() #define _PR_UNLOCK_ENV() #elif defined(_PR_LOCAL_THREADS_ONLY) +extern _PRCPU * _pr_primordialCPU; +static PRIntn _is; #define _PR_NEW_LOCK_ENV() -#define _PR_LOCK_ENV() { PRIntn _is; _PR_INTSOFF(_is) -#define _PR_UNLOCK_ENV() _PR_INTSON(_is); } +#define _PR_LOCK_ENV() if (_pr_primordialCPU) _PR_INTSOFF(_is); +#define _PR_UNLOCK_ENV() if (_pr_primordialCPU) _PR_INTSON(_is); #else -static PRLock *_pr_envLock; +static PRLock *_pr_envLock = NULL; #define _PR_NEW_LOCK_ENV() {_pr_envLock = PR_NewLock();} -#define _PR_LOCK_ENV() PR_Lock(_pr_envLock) -#define _PR_UNLOCK_ENV() PR_Unlock(_pr_envLock) +#define _PR_LOCK_ENV() { if (_pr_envLock) PR_Lock(_pr_envLock); } +#define _PR_UNLOCK_ENV() { if (_pr_envLock) PR_Unlock(_pr_envLock); } #endif /************************************************************************/ |