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:
Jérôme Duval
2011-02-24 17:28:59 +00:00
parent 2f76808976
commit bafa759148
4 changed files with 16 additions and 2 deletions
@@ -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
}
+1
View File
@@ -60,6 +60,7 @@ initialize_before(image_id imageID)
__init_env(__gRuntimeLoader->program_args);
__init_heap_post_env();
__init_pwd_backend();
__init_pthread();
}
+4 -1
View File
@@ -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;
}
+9 -1
View File
@@ -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