refactored code out to mzrt_proc_first_thread_init
svn: r12818
This commit is contained in:
parent
c70abd63e5
commit
51eb2a8257
|
@ -176,6 +176,15 @@ unsigned int mz_proc_thread_id(mz_proc_thread* thread) {
|
|||
return (unsigned int) thread->threadid;
|
||||
}
|
||||
|
||||
mz_proc_thread* mzrt_proc_first_thread_init() {
|
||||
/* initialize mz_proc_thread struct for first thread myself that wasn't created with mz_proc_thread_create,
|
||||
* so it can communicate with other mz_proc_thread_created threads via pt_mboxes */
|
||||
mz_proc_thread *thread = (mz_proc_thread*)malloc(sizeof(mz_proc_thread));
|
||||
thread->mbox = pt_mbox_create();
|
||||
thread->threadid = mz_proc_thread_self();
|
||||
proc_thread_self = thread;
|
||||
return thread;
|
||||
}
|
||||
|
||||
mz_proc_thread* mz_proc_thread_create(mz_proc_thread_start start_proc, void* data) {
|
||||
mz_proc_thread *thread = (mz_proc_thread*)malloc(sizeof(mz_proc_thread));
|
||||
|
|
|
@ -39,6 +39,7 @@ typedef DWORD (WINAPI *mz_proc_thread_start)(void*);
|
|||
typedef void *(mz_proc_thread_start)(void*);
|
||||
#endif
|
||||
|
||||
mz_proc_thread* mzrt_proc_first_thread_init();
|
||||
mz_proc_thread* mz_proc_thread_create(mz_proc_thread_start*, void* data);
|
||||
void *mz_proc_thread_wait(mz_proc_thread *thread);
|
||||
|
||||
|
|
|
@ -280,15 +280,7 @@ static void *master_scheme_place(void *data) {
|
|||
}
|
||||
|
||||
void spawn_master_scheme_place() {
|
||||
mz_proc_thread *thread;
|
||||
pt_mbox *mbox;
|
||||
unsigned int threadid;
|
||||
thread = (mz_proc_thread*)malloc(sizeof(mz_proc_thread));
|
||||
mbox = pt_mbox_create();
|
||||
threadid = mz_proc_thread_self();
|
||||
thread->threadid = threadid;
|
||||
thread->mbox = mbox;
|
||||
proc_thread_self = thread;
|
||||
mzrt_proc_first_thread_init();
|
||||
|
||||
scheme_master_proc_thread = mz_proc_thread_create(master_scheme_place, NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user