mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 01:31:08 +00:00
improve debug/error logging a little.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25780 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
af737363bc
commit
c6e8018204
3 changed files with 38 additions and 26 deletions
|
@ -52,7 +52,7 @@ extern "C" {
|
||||||
NSMutableDictionary *_thread_dictionary;
|
NSMutableDictionary *_thread_dictionary;
|
||||||
struct autorelease_thread_vars _autorelease_vars;
|
struct autorelease_thread_vars _autorelease_vars;
|
||||||
id _gcontext;
|
id _gcontext;
|
||||||
void *_reserved; // For mfuture expansion
|
void *_reserved; // For future expansion
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSThread*) currentThread;
|
+ (NSThread*) currentThread;
|
||||||
|
|
|
@ -853,27 +853,39 @@ gnustep_base_thread_callback(void)
|
||||||
|
|
||||||
- (void) start
|
- (void) start
|
||||||
{
|
{
|
||||||
if (_active == NO)
|
if (_active == YES)
|
||||||
{
|
{
|
||||||
/* Make sure the notification is posted BEFORE the new thread starts.
|
[NSException raise: NSInternalInconsistencyException
|
||||||
*/
|
format: @"[%@-$@] called on active thread",
|
||||||
gnustep_base_thread_callback();
|
NSStringFromClass([self class]),
|
||||||
|
NSStringFromSelector(_cmd)];
|
||||||
|
}
|
||||||
|
if (_cancelled == YES)
|
||||||
|
{
|
||||||
|
[NSException raise: NSInternalInconsistencyException
|
||||||
|
format: @"[%@-$@] called on cancelled thread",
|
||||||
|
NSStringFromClass([self class]),
|
||||||
|
NSStringFromSelector(_cmd)];
|
||||||
|
}
|
||||||
|
|
||||||
/* The thread must persist until if finishes executing.
|
/* Make sure the notification is posted BEFORE the new thread starts.
|
||||||
*/
|
*/
|
||||||
RETAIN(self);
|
gnustep_base_thread_callback();
|
||||||
|
|
||||||
/* Mark the thread as active whiul it's running.
|
/* The thread must persist until it finishes executing.
|
||||||
*/
|
*/
|
||||||
_active = YES;
|
RETAIN(self);
|
||||||
|
|
||||||
if (objc_thread_detach(@selector(main), self, nil) == NULL)
|
/* Mark the thread as active whiul it's running.
|
||||||
{
|
*/
|
||||||
_active = NO;
|
_active = YES;
|
||||||
RELEASE(self);
|
|
||||||
[NSException raise: NSInternalInconsistencyException
|
if (objc_thread_detach(@selector(main), self, nil) == NULL)
|
||||||
format: @"Unable to detach thread (unknown error)"];
|
{
|
||||||
}
|
_active = NO;
|
||||||
|
RELEASE(self);
|
||||||
|
[NSException raise: NSInternalInconsistencyException
|
||||||
|
format: @"Unable to detach thread (unknown error)"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,14 @@ static Class NSDate_class;
|
||||||
{
|
{
|
||||||
[self invalidate];
|
[self invalidate];
|
||||||
}
|
}
|
||||||
|
if (_target != nil)
|
||||||
|
{
|
||||||
|
DESTROY(_target);
|
||||||
|
}
|
||||||
|
if (_info != nil)
|
||||||
|
{
|
||||||
|
DESTROY(_info);
|
||||||
|
}
|
||||||
RELEASE(_date);
|
RELEASE(_date);
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
@ -253,14 +261,6 @@ static Class NSDate_class;
|
||||||
*/
|
*/
|
||||||
- (void) invalidate
|
- (void) invalidate
|
||||||
{
|
{
|
||||||
if (_target != nil)
|
|
||||||
{
|
|
||||||
DESTROY(_target);
|
|
||||||
}
|
|
||||||
if (_info != nil)
|
|
||||||
{
|
|
||||||
DESTROY(_info);
|
|
||||||
}
|
|
||||||
/* OPENSTEP allows this method to be called multiple times. */
|
/* OPENSTEP allows this method to be called multiple times. */
|
||||||
//NSAssert(_invalidated == NO, NSInternalInconsistencyException);
|
//NSAssert(_invalidated == NO, NSInternalInconsistencyException);
|
||||||
_invalidated = YES;
|
_invalidated = YES;
|
||||||
|
|
Loading…
Reference in a new issue