Skip to content

Commit 83ed737

Browse files
committed
xrCore: was improoved linux thread creation (fix crash at second thread)
1 parent 1da5f72 commit 83ed737

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/xrCore/_math.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,11 @@ struct THREAD_STARTUP
356356
char* name;
357357
void* args;
358358
};
359+
#if defined(WINDOWS)
359360
void __cdecl thread_entry(void* _params)
361+
#elif defined(LINUX)
362+
void *__cdecl thread_entry(void* _params)
363+
#endif
360364
{
361365
// initialize
362366
THREAD_STARTUP* startup = (THREAD_STARTUP*)_params;
@@ -384,7 +388,8 @@ void thread_spawn(thread_t* entry, const char* name, unsigned stack, void* argli
384388
pthread_t handle;
385389
pthread_attr_t attr;
386390
pthread_attr_init(&attr);
387-
pthread_create(&handle, &attr, NULL, arglist); //TODO convert entry
391+
pthread_attr_setstacksize(&attr, stack);
392+
pthread_create(&handle, &attr, &thread_entry, startup);
388393
pthread_attr_destroy(&attr);
389394
#endif
390395
}

0 commit comments

Comments
 (0)