1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Backport of this changeset

http://lists.mysql.com/commits/59686

Cleanup pthread_self(), pthread_create(), pthread_join() implementation on Windows.
Prior implementation is was unnecessarily complicated and even differs in embedded
and non-embedded case.
      
Improvements in this patch:
* pthread_t is now the unique thread ID, instead of HANDLE returned by beginthread
      
This simplifies pthread_self() to be just straight GetCurrentThreadId().
prior it was much  art involved in passing the beginthread() handle from the caller
to the TLS structure in the child thread ( did not work for the main thread of
course)
      
* remove MySQL specific my_thread_init()/my_thread_end() from pthread_create.
No automagic is done on Unix on pthread_create(). Having the same on Windows will 
improve portability and avoid extra #ifdef's
      
* remove redefinition of getpid() - it was defined as GetCurrentThreadId()
This commit is contained in:
Vladislav Vaintroub
2009-09-30 17:40:12 +02:00
parent 2801599323
commit 9cf8d12c85
9 changed files with 131 additions and 139 deletions

View File

@@ -2498,7 +2498,6 @@ pthread_handler_t handle_delayed_insert(void *arg)
since it does not find one in the list.
*/
pthread_mutex_lock(&di->mutex);
#if !defined( __WIN__) /* Win32 calls this in pthread_create */
if (my_thread_init())
{
/* Can't use my_error since store_globals has not yet been called */
@@ -2506,13 +2505,9 @@ pthread_handler_t handle_delayed_insert(void *arg)
ER(ER_OUT_OF_RESOURCES), NULL);
goto end;
}
#endif
handle_delayed_insert_impl(thd, di);
#ifndef __WIN__
end:
#endif
/*
di should be unlinked from the thread handler list and have no active
clients