mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-26 02:01:03 +00:00
(+detachNewThreadSelector:toTarget:withObject:): Don't set entered_multi_threaded_state to NO if the objc_thread_detach call fails.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18262 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
62673068d0
commit
12d2a05aa8
2 changed files with 22 additions and 14 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2003-12-23 18:38 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
|
* Source/NSThread.m: Don't use '\r\n' in printf strings (stdio/libc
|
||||||
|
is responsible for converting it to local convention).
|
||||||
|
|
||||||
|
(+detachNewThreadSelector:toTarget:withObject:): Don't set
|
||||||
|
entered_multi_threaded_state to NO if the objc_thread_detach call
|
||||||
|
fails.
|
||||||
|
|
||||||
2003-12-23 18:15 Alexander Malmberg <alexander@malmberg.org>
|
2003-12-23 18:15 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
* Documentation/news.texi, Headers/Foundation/NSDebug.h,
|
* Documentation/news.texi, Headers/Foundation/NSDebug.h,
|
||||||
|
|
|
@ -64,7 +64,7 @@ static NSNotificationCenter *nc = nil;
|
||||||
void
|
void
|
||||||
GSSleepUntilIntervalSinceReferenceDate(NSTimeInterval when)
|
GSSleepUntilIntervalSinceReferenceDate(NSTimeInterval when)
|
||||||
{
|
{
|
||||||
extern NSTimeInterval GSTimeNow();
|
extern NSTimeInterval GSTimeNow(void);
|
||||||
NSTimeInterval delay;
|
NSTimeInterval delay;
|
||||||
|
|
||||||
// delay is always the number of seconds we still need to wait
|
// delay is always the number of seconds we still need to wait
|
||||||
|
@ -142,7 +142,7 @@ GSSleepUntilIntervalSinceReferenceDate(NSTimeInterval when)
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSArray *
|
static NSArray *
|
||||||
commonModes()
|
commonModes(void)
|
||||||
{
|
{
|
||||||
static NSArray *modes = nil;
|
static NSArray *modes = nil;
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ extern objc_mutex_t __objc_runtime_mutex;
|
||||||
extern int __objc_runtime_threads_alive;
|
extern int __objc_runtime_threads_alive;
|
||||||
extern int __objc_is_multi_threaded;
|
extern int __objc_is_multi_threaded;
|
||||||
|
|
||||||
inline static void objc_thread_add ()
|
inline static void objc_thread_add (void)
|
||||||
{
|
{
|
||||||
objc_mutex_lock(__objc_runtime_mutex);
|
objc_mutex_lock(__objc_runtime_mutex);
|
||||||
__objc_is_multi_threaded = 1;
|
__objc_is_multi_threaded = 1;
|
||||||
|
@ -185,7 +185,7 @@ inline static void objc_thread_add ()
|
||||||
objc_mutex_unlock(__objc_runtime_mutex);
|
objc_mutex_unlock(__objc_runtime_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static void objc_thread_remove ()
|
inline static void objc_thread_remove (void)
|
||||||
{
|
{
|
||||||
objc_mutex_lock(__objc_runtime_mutex);
|
objc_mutex_lock(__objc_runtime_mutex);
|
||||||
__objc_runtime_threads_alive--;
|
__objc_runtime_threads_alive--;
|
||||||
|
@ -223,7 +223,7 @@ static NSThread *defaultThread = nil;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
inline NSThread*
|
inline NSThread*
|
||||||
GSCurrentThread()
|
GSCurrentThread(void)
|
||||||
{
|
{
|
||||||
NSThread *t;
|
NSThread *t;
|
||||||
|
|
||||||
|
@ -248,9 +248,9 @@ GSCurrentThread()
|
||||||
if (t == nil)
|
if (t == nil)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"ALERT ... GSCurrentThread() ... objc_thread_get_data() call returned nil!\r\n"
|
"ALERT ... GSCurrentThread() ... objc_thread_get_data() call returned nil!\n"
|
||||||
"Your application MUST call GSRegisterCurrentThread() before attempting to\r\n"
|
"Your application MUST call GSRegisterCurrentThread() before attempting to\n"
|
||||||
"use any GNUstep code from a thread other than the main GNUstep thread.\r\n");
|
"use any GNUstep code from a thread other than the main GNUstep thread.\n");
|
||||||
fflush(stderr); // Needed for windoze
|
fflush(stderr); // Needed for windoze
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ GSDictionaryForThread(NSThread *t)
|
||||||
* Fast access function for thread dictionary of current thread.
|
* Fast access function for thread dictionary of current thread.
|
||||||
*/
|
*/
|
||||||
NSMutableDictionary*
|
NSMutableDictionary*
|
||||||
GSCurrentThreadDictionary()
|
GSCurrentThreadDictionary(void)
|
||||||
{
|
{
|
||||||
return GSDictionaryForThread(nil);
|
return GSDictionaryForThread(nil);
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ GSCurrentThreadDictionary()
|
||||||
* on-disk database.
|
* on-disk database.
|
||||||
*/
|
*/
|
||||||
static NSTimer *housekeeper = nil;
|
static NSTimer *housekeeper = nil;
|
||||||
NSTimer *GSHousekeeper()
|
NSTimer *GSHousekeeper(void)
|
||||||
{
|
{
|
||||||
return housekeeper;
|
return housekeeper;
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ GSRunLoopForThread(NSThread *t)
|
||||||
* Callback function so send notifications on becoming multi-threaded.
|
* Callback function so send notifications on becoming multi-threaded.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
gnustep_base_thread_callback()
|
gnustep_base_thread_callback(void)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Protect this function with locking ... to avoid any possibility
|
* Protect this function with locking ... to avoid any possibility
|
||||||
|
@ -400,8 +400,8 @@ gnustep_base_thread_callback()
|
||||||
NS_HANDLER
|
NS_HANDLER
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"ALERT ... exception while becoming multi-threaded ... system may not be\r\n"
|
"ALERT ... exception while becoming multi-threaded ... system may not be\n"
|
||||||
"properly initialised.\r\n");
|
"properly initialised.\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
NS_ENDHANDLER
|
NS_ENDHANDLER
|
||||||
|
@ -488,7 +488,6 @@ gnustep_base_thread_callback()
|
||||||
*/
|
*/
|
||||||
if (objc_thread_detach(@selector(_sendThreadMethod), thread, nil) == NULL)
|
if (objc_thread_detach(@selector(_sendThreadMethod), thread, nil) == NULL)
|
||||||
{
|
{
|
||||||
entered_multi_threaded_state = NO;
|
|
||||||
[NSException raise: NSInternalInconsistencyException
|
[NSException raise: NSInternalInconsistencyException
|
||||||
format: @"Unable to detach thread (unknown error)"];
|
format: @"Unable to detach thread (unknown error)"];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue