summaryrefslogtreecommitdiff
path: root/innobase/include
diff options
context:
space:
mode:
authorheikki@hundin.mysql.fi <>2003-05-30 22:44:37 +0300
committerheikki@hundin.mysql.fi <>2003-05-30 22:44:37 +0300
commitd1759530d3c018de0f9cda544b32bc94bfb48400 (patch)
tree9565fc6f3fff83d440f4639b6183c6c4a59a7433 /innobase/include
parent3317cfdc7d756a54d53712ede7e68fcd98a71ade (diff)
downloadmariadb-git-d1759530d3c018de0f9cda544b32bc94bfb48400.tar.gz
Many files:
Exit all threads created by innoDB at shutdown
Diffstat (limited to 'innobase/include')
-rw-r--r--innobase/include/os0file.h7
-rw-r--r--innobase/include/os0sync.h12
-rw-r--r--innobase/include/os0thread.h8
3 files changed, 22 insertions, 5 deletions
diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h
index a7624a90d5e..86f27a2d3eb 100644
--- a/innobase/include/os0file.h
+++ b/innobase/include/os0file.h
@@ -301,6 +301,13 @@ os_aio(
are ignored */
void* message2);
/****************************************************************************
+Wakes up all async i/o threads so that they know to exit themselves in
+shutdown. */
+
+void
+os_aio_wake_all_threads_at_shutdown(void);
+/*=====================================*/
+/****************************************************************************
Waits until there are no pending writes in os_aio_write_array. There can
be other, synchronous, pending writes. */
diff --git a/innobase/include/os0sync.h b/innobase/include/os0sync.h
index b2d613c4619..d52444d02ec 100644
--- a/innobase/include/os0sync.h
+++ b/innobase/include/os0sync.h
@@ -38,6 +38,13 @@ typedef os_mutex_str_t* os_mutex_t;
#define OS_SYNC_TIME_EXCEEDED 1
+/* Mutex protecting the thread count */
+extern os_mutex_t os_thread_count_mutex;
+
+/* This is incremented by 1 in os_thread_create and decremented by 1 in
+os_thread_exit */
+extern ulint os_thread_count;
+
/*************************************************************
Creates an event semaphore, i.e., a semaphore which may
just have two states: signaled and nonsignaled.
@@ -85,7 +92,10 @@ os_event_free(
/*==========*/
os_event_t event); /* in: event to free */
/**************************************************************
-Waits for an event object until it is in the signaled state. */
+Waits for an event object until it is in the signaled state. If
+srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS this also exits the
+waiting thread when the event becomes signaled (or immediately if the
+event is already in the signaled state). */
void
os_event_wait(
diff --git a/innobase/include/os0thread.h b/innobase/include/os0thread.h
index 629cfef23a8..29154a9e7cf 100644
--- a/innobase/include/os0thread.h
+++ b/innobase/include/os0thread.h
@@ -11,6 +11,7 @@ Created 9/8/1995 Heikki Tuuri
#define os0thread_h
#include "univ.i"
+#include "os0sync.h"
/* Maximum number of threads which can be created in the program;
this is also the size of the wait slot array for MySQL threads which
@@ -41,7 +42,6 @@ typedef os_thread_t os_thread_id_t; /* In Unix we use the thread
the thread */
#endif
-
/* Define a function pointer type to use in a typecast */
typedef void* (*os_posix_f_t) (void*);
@@ -83,12 +83,13 @@ os_thread_create(
os_thread_id_t* thread_id); /* out: id of the created
thread */
/*********************************************************************
-A thread calling this function ends its execution. */
+Exits the current thread. */
void
os_thread_exit(
/*===========*/
- ulint code); /* in: exit code */
+ void* exit_value); /* in: exit value; in Windows this void*
+ is cast as a DWORD */
/*********************************************************************
Returns the thread identifier of current thread. */
@@ -144,7 +145,6 @@ ulint
os_thread_get_last_error(void);
/*==========================*/
-
#ifndef UNIV_NONINL
#include "os0thread.ic"
#endif