Resolve bug 17464

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23488 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2006-09-13 10:20:49 +00:00
parent 951739fc7d
commit d7ae63696c
109 changed files with 994 additions and 82 deletions

View file

@ -241,12 +241,10 @@ typedef struct NCTbl {
GSIMapTable named; /* Getting named messages only. */
unsigned lockCount; /* Count recursive operations. */
GSLazyRecursiveLock *_lock; /* Lock out other threads. */
BOOL lockingDisabled;
Observation *freeList;
Observation **chunks;
unsigned numChunks;
GSIMapTable cache[CACHESIZE];
Observation *freeList;
Observation **chunks;
unsigned numChunks;
GSIMapTable cache[CACHESIZE];
unsigned short chunkIndex;
unsigned short cacheIndex;
} NCTable;
@ -407,16 +405,14 @@ static NCTable *newNCTable(void)
static inline void lockNCTable(NCTable* t)
{
if (t->lockingDisabled == NO)
[t->_lock lock];
[t->_lock lock];
t->lockCount++;
}
static inline void unlockNCTable(NCTable* t)
{
t->lockCount--;
if (t->lockingDisabled == NO)
[t->_lock unlock];
[t->_lock unlock];
}
static void obsFree(Observation *o)
@ -1142,32 +1138,3 @@ static NSNotificationCenter *default_center = nil;
@end
@implementation NSNotificationCenter (GNUstep)
- (BOOL) setLockingDisabled: (BOOL)flag
{
BOOL old;
GSOnceMLog(@"This method is deprecated");
lockNCTable(TABLE);
if (self == default_center)
{
unlockNCTable(TABLE);
[NSException raise: NSInvalidArgumentException
format: @"Can't change locking of default center."];
}
if (LOCKCOUNT > 1)
{
unlockNCTable(TABLE);
[NSException raise: NSInvalidArgumentException
format: @"Can't change locking during post."];
}
old = TABLE->lockingDisabled;
TABLE->lockingDisabled = flag;
unlockNCTable(TABLE);
return old;
}
@end