From d9711e32b966610af3969c76f7e96f18478dffca Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 30 May 2003 22:44:37 +0300 Subject: Many files: Exit all threads created by innoDB at shutdown innobase/os/os0file.c: Exit all threads created by innoDB at shutdown innobase/os/os0sync.c: Exit all threads created by innoDB at shutdown innobase/os/os0thread.c: Exit all threads created by innoDB at shutdown innobase/include/os0file.h: Exit all threads created by innoDB at shutdown innobase/include/os0sync.h: Exit all threads created by innoDB at shutdown innobase/include/os0thread.h: Exit all threads created by innoDB at shutdown innobase/log/log0log.c: Exit all threads created by innoDB at shutdown innobase/srv/srv0srv.c: Exit all threads created by innoDB at shutdown innobase/srv/srv0start.c: Exit all threads created by innoDB at shutdown --- innobase/os/os0thread.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'innobase/os/os0thread.c') diff --git a/innobase/os/os0thread.c b/innobase/os/os0thread.c index b0076921e43..a68f6a3b8bc 100644 --- a/innobase/os/os0thread.c +++ b/innobase/os/os0thread.c @@ -1,6 +1,5 @@ /****************************************************** -The interface to the operating system -process and thread control primitives +The interface to the operating system thread control primitives (c) 1995 Innobase Oy @@ -102,6 +101,10 @@ os_thread_create( os_thread_t thread; ulint win_thread_id; + os_mutex_enter(os_thread_count_mutex); + os_thread_count++; + os_mutex_exit(os_thread_count_mutex); + thread = CreateThread(NULL, /* no security attributes */ 0, /* default size stack */ (LPTHREAD_START_ROUTINE)start_f, @@ -144,6 +147,9 @@ os_thread_create( exit(1); } #endif + os_mutex_enter(os_thread_count_mutex); + os_thread_count++; + os_mutex_exit(os_thread_count_mutex); #if defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10) ret = pthread_create(&pthread, pthread_attr_default, start_f, arg); @@ -170,6 +176,26 @@ os_thread_create( #endif } +/********************************************************************* +Exits the current thread. */ + +void +os_thread_exit( +/*===========*/ + void* exit_value) /* in: exit value; in Windows this void* + is cast as a DWORD */ +{ + os_mutex_enter(os_thread_count_mutex); + os_thread_count--; + os_mutex_exit(os_thread_count_mutex); + +#ifdef __WIN__ + ExitThread((DWORD)exit_value); +#else + pthread_exit(exit_value); +#endif +} + /********************************************************************* Returns handle to the current thread. */ -- cgit v1.2.1