summaryrefslogtreecommitdiff
path: root/innobase/os/os0thread.c
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2003-05-30 22:44:37 +0300
committerunknown <heikki@hundin.mysql.fi>2003-05-30 22:44:37 +0300
commitd9711e32b966610af3969c76f7e96f18478dffca (patch)
tree9565fc6f3fff83d440f4639b6183c6c4a59a7433 /innobase/os/os0thread.c
parentfadfa46796576b5566ee3f45920b07e2f2326552 (diff)
downloadmariadb-git-d9711e32b966610af3969c76f7e96f18478dffca.tar.gz
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
Diffstat (limited to 'innobase/os/os0thread.c')
-rw-r--r--innobase/os/os0thread.c30
1 files changed, 28 insertions, 2 deletions
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);
@@ -171,6 +177,26 @@ os_thread_create(
}
/*********************************************************************
+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. */
os_thread_t