Skip to content

Commit

Permalink
xrCore: was improoved linux thread creation (fix crash at second thread)
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleivg committed Oct 9, 2018
1 parent 1da5f72 commit 83ed737
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/xrCore/_math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,11 @@ struct THREAD_STARTUP
char* name;
void* args;
};
#if defined(WINDOWS)
void __cdecl thread_entry(void* _params)
#elif defined(LINUX)
void *__cdecl thread_entry(void* _params)
#endif
{
// initialize
THREAD_STARTUP* startup = (THREAD_STARTUP*)_params;
Expand Down Expand Up @@ -384,7 +388,8 @@ void thread_spawn(thread_t* entry, const char* name, unsigned stack, void* argli
pthread_t handle;
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_create(&handle, &attr, NULL, arglist); //TODO convert entry
pthread_attr_setstacksize(&attr, stack);
pthread_create(&handle, &attr, &thread_entry, startup);
pthread_attr_destroy(&attr);
#endif
}
Expand Down

0 comments on commit 83ed737

Please sign in to comment.