now correctly init the thread id in the pthread struct for main thread and threads spawned with spawn_thread(). This definitely helps for #7235.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40665 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -41,6 +41,8 @@ void __init_pwd_backend(void);
|
||||
void __reinit_pwd_backend_after_fork(void);
|
||||
void* __arch_get_caller(void);
|
||||
|
||||
void __init_pthread(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ initialize_before(image_id imageID)
|
||||
__init_env(__gRuntimeLoader->program_args);
|
||||
__init_heap_post_env();
|
||||
__init_pwd_backend();
|
||||
__init_pthread();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -99,7 +99,10 @@ spawn_thread(thread_func entry, const char *name, int32 priority, void *data)
|
||||
attributes.stack_address = NULL;
|
||||
attributes.stack_size = 0;
|
||||
|
||||
return _kern_spawn_thread(&attributes);
|
||||
thread->id = _kern_spawn_thread(&attributes);
|
||||
if (thread->id < 0)
|
||||
free(thread);
|
||||
return thread->id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "pthread_private.h"
|
||||
#include <libroot_private.h>
|
||||
#include <pthread_private.h>
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
@@ -93,6 +94,13 @@ __allocate_pthread(void *data)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
__init_pthread(void)
|
||||
{
|
||||
sMainThread.id = find_thread(NULL);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - public API
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user