mirror of
https://github.com/MariaDB/server.git
synced 2025-08-29 00:08:14 +03:00
os0thread.c Use pthread_attr_init instead of ..._create
This commit is contained in:
@@ -26,7 +26,16 @@ os_thread_get_curr_id(void)
|
||||
#ifdef __WIN__
|
||||
return(GetCurrentThreadId());
|
||||
#else
|
||||
return((os_thread_id_t) pthread_self());
|
||||
pthread_t pthr;
|
||||
|
||||
pthr = pthread_self();
|
||||
|
||||
/* TODO: in the future we have to change os_thread_id
|
||||
to pthread_t; the following cast may work in a wrong way on some
|
||||
systems if pthread_t is a struct; this is just a quick fix
|
||||
for HP-UX to eliminate a compiler warning */
|
||||
|
||||
return(*(os_thread_id_t*)((void*) (&pthr)));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -65,9 +74,14 @@ os_thread_create(
|
||||
#else
|
||||
int ret;
|
||||
os_thread_t pthread;
|
||||
pthread_attr_t attr;
|
||||
|
||||
pthread_attr_init(&attr);
|
||||
|
||||
ret = pthread_create(&pthread, NULL, start_f, arg);
|
||||
|
||||
pthread_attr_destroy(&attr);
|
||||
|
||||
return(pthread);
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user