mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Thread diagnositc changes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38768 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
dffcd0bb1c
commit
999fda788a
7 changed files with 110 additions and 28 deletions
|
@ -58,6 +58,7 @@
|
|||
}
|
||||
|
||||
#if defined(HAVE_PTHREAD_MUTEX_OWNER)
|
||||
|
||||
#define MDESCRIPTION \
|
||||
- (NSString*) description\
|
||||
{\
|
||||
|
@ -65,11 +66,11 @@
|
|||
{\
|
||||
if (_name == nil)\
|
||||
{\
|
||||
return [NSString stringWithFormat: @"%@ (locked by %d)",\
|
||||
[super description], (int)_mutex.__data.__owner];\
|
||||
return [NSString stringWithFormat: @"%@ (locked by %llu)",\
|
||||
[super description], (NSUInteger)_mutex.__data.__owner];\
|
||||
}\
|
||||
return [NSString stringWithFormat: @"%@ '%@' (locked by %d)",\
|
||||
[super description], _name, (int)_mutex.__data.__owner];\
|
||||
return [NSString stringWithFormat: @"%@ '%@' (locked by %llu)",\
|
||||
[super description], _name, (NSUInteger)_mutex.__data.__owner];\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
|
@ -81,7 +82,18 @@
|
|||
[super description], _name];\
|
||||
}\
|
||||
}
|
||||
|
||||
#define MISLOCKED \
|
||||
- (BOOL) isLockedByCurrentThread\
|
||||
{\
|
||||
if (GSPrivateThreadID() == (NSUInteger)_mutex.__data.__owner)\
|
||||
return YES;\
|
||||
else\
|
||||
return NO; \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define MDESCRIPTION \
|
||||
- (NSString*) description\
|
||||
{\
|
||||
|
@ -92,6 +104,14 @@
|
|||
return [NSString stringWithFormat: @"%@ '%@'",\
|
||||
[super description], _name];\
|
||||
}
|
||||
|
||||
#define MISLOCKED \
|
||||
- (BOOL) isLockedByCurrentThread\
|
||||
{\
|
||||
[NSException raise: NSGenericException format: @"Not supported"];\
|
||||
return NO;\
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define MFINALIZE \
|
||||
|
@ -235,6 +255,7 @@ MFINALIZE
|
|||
return self;
|
||||
}
|
||||
|
||||
MISLOCKED
|
||||
MLOCK
|
||||
|
||||
- (BOOL) lockBeforeDate: (NSDate*)limit
|
||||
|
@ -283,6 +304,7 @@ MFINALIZE
|
|||
return self;
|
||||
}
|
||||
|
||||
MISLOCKED
|
||||
MLOCK
|
||||
MLOCKBEFOREDATE
|
||||
MNAME
|
||||
|
@ -328,6 +350,7 @@ MDESCRIPTION
|
|||
return self;
|
||||
}
|
||||
|
||||
MISLOCKED
|
||||
MLOCK
|
||||
MLOCKBEFOREDATE
|
||||
MNAME
|
||||
|
@ -414,6 +437,11 @@ MUNLOCK
|
|||
return self;
|
||||
}
|
||||
|
||||
- (BOOL) isLockedByCurrentThread
|
||||
{
|
||||
return [_condition isLockedByCurrentThread];
|
||||
}
|
||||
|
||||
- (void) lock
|
||||
{
|
||||
[_condition lock];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue