Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
bb1f4142
Commit
bb1f4142
authored
Jun 02, 2017
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
InnoDB: Remove thread_mutex
Use my_atomic for updating os_thread_count. os_thread_init(): Remove.
parent
86927cc7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
52 deletions
+6
-52
storage/innobase/include/os0thread.h
storage/innobase/include/os0thread.h
+0
-8
storage/innobase/include/sync0types.h
storage/innobase/include/sync0types.h
+0
-1
storage/innobase/os/os0thread.cc
storage/innobase/os/os0thread.cc
+6
-40
storage/innobase/srv/srv0srv.cc
storage/innobase/srv/srv0srv.cc
+0
-1
storage/innobase/sync/sync0debug.cc
storage/innobase/sync/sync0debug.cc
+0
-2
No files found.
storage/innobase/include/os0thread.h
View file @
bb1f4142
...
...
@@ -151,23 +151,15 @@ os_thread_sleep(
/*============*/
ulint
tm
);
/*!< in: time in microseconds */
/**
Initializes OS thread management data structures. */
void
os_thread_init
();
/*============*/
/**
Frees OS thread management data structures. */
void
os_thread_free
();
/*============*/
/*****************************************************************//**
Check if there are threads active.
@return true if the thread count > 0. */
bool
os_thread_active
();
/*==============*/
#endif
storage/innobase/include/sync0types.h
View file @
bb1f4142
...
...
@@ -354,7 +354,6 @@ enum latch_id_t {
LATCH_ID_EVENT_MANAGER
,
LATCH_ID_EVENT_MUTEX
,
LATCH_ID_SYNC_ARRAY_MUTEX
,
LATCH_ID_THREAD_MUTEX
,
LATCH_ID_ZIP_PAD_MUTEX
,
LATCH_ID_OS_AIO_READ_MUTEX
,
LATCH_ID_OS_AIO_WRITE_MUTEX
,
...
...
storage/innobase/os/os0thread.cc
View file @
bb1f4142
...
...
@@ -31,14 +31,9 @@ Created 9/8/1995 Heikki Tuuri
#include "os0event.h"
#include <map>
/** Mutex that tracks the thread count. Used by innorwlocktest.cc
FIXME: the unit tests should use APIs */
SysMutex
thread_mutex
;
/** Number of threads active. */
ulint
os_thread_count
;
/***************************************************************//**
Compares two thread ids for equality.
@return TRUE if equal */
...
...
@@ -127,11 +122,7 @@ os_thread_create_func(
CloseHandle
(
handle
);
mutex_enter
(
&
thread_mutex
);
os_thread_count
++
;
mutex_exit
(
&
thread_mutex
);
my_atomic_addlint
(
&
os_thread_count
,
1
);
return
((
os_thread_t
)
new_thread_id
);
#else
/* _WIN32 else */
...
...
@@ -140,9 +131,7 @@ os_thread_create_func(
pthread_attr_init
(
&
attr
);
mutex_enter
(
&
thread_mutex
);
++
os_thread_count
;
mutex_exit
(
&
thread_mutex
);
my_atomic_addlint
(
&
os_thread_count
,
1
);
int
ret
=
pthread_create
(
&
new_thread_id
,
&
attr
,
func
,
arg
);
...
...
@@ -197,16 +186,11 @@ os_thread_exit(
pfs_delete_thread
();
#endif
mutex_enter
(
&
thread_mutex
);
os_thread_count
--
;
my_atomic_addlint
(
&
os_thread_count
,
-
1
);
#ifdef _WIN32
mutex_exit
(
&
thread_mutex
);
ExitThread
(
0
);
#else
mutex_exit
(
&
thread_mutex
);
if
(
detach
)
{
pthread_detach
(
pthread_self
());
}
...
...
@@ -260,10 +244,6 @@ bool
os_thread_active
()
/*==============*/
{
mutex_enter
(
&
thread_mutex
);
bool
active
=
(
os_thread_count
>
0
);
/* All the threads have exited or are just exiting;
NOTE that the threads may not have completed their
exit yet. Should we use pthread_join() to make sure
...
...
@@ -272,30 +252,16 @@ os_thread_active()
os_thread_exit(). Now we just sleep 0.1
seconds and hope that is enough! */
mutex_exit
(
&
thread_mutex
);
return
(
active
);
}
/**
Initializes OS thread management data structures. */
void
os_thread_init
()
/*============*/
{
mutex_create
(
LATCH_ID_THREAD_MUTEX
,
&
thread_mutex
);
return
(
my_atomic_loadlint
(
&
os_thread_count
)
>
0
);
}
/**
Frees OS thread management data structures. */
void
os_thread_free
()
/*============*/
{
if
(
os_thread_count
!=
0
)
{
ib
::
warn
()
<<
"Some ("
<<
os_thread_
count
<<
") threads are"
if
(
ulint
count
=
my_atomic_loadlint
(
&
os_thread_count
)
)
{
ib
::
warn
()
<<
"Some ("
<<
count
<<
") threads are"
" still active"
;
}
mutex_destroy
(
&
thread_mutex
);
}
storage/innobase/srv/srv0srv.cc
View file @
bb1f4142
...
...
@@ -1183,7 +1183,6 @@ srv_boot(void)
srv_normalize_init_values
();
sync_check_init
();
os_thread_init
();
/* Reset the system variables in the recovery module. */
recv_sys_var_init
();
trx_pool_init
();
...
...
storage/innobase/sync/sync0debug.cc
View file @
bb1f4142
...
...
@@ -1498,8 +1498,6 @@ sync_latch_meta_init()
LATCH_ADD_MUTEX
(
SYNC_ARRAY_MUTEX
,
SYNC_NO_ORDER_CHECK
,
sync_array_mutex_key
);
LATCH_ADD_MUTEX
(
THREAD_MUTEX
,
SYNC_NO_ORDER_CHECK
,
thread_mutex_key
);
LATCH_ADD_MUTEX
(
ZIP_PAD_MUTEX
,
SYNC_NO_ORDER_CHECK
,
zip_pad_mutex_key
);
LATCH_ADD_MUTEX
(
OS_AIO_READ_MUTEX
,
SYNC_NO_ORDER_CHECK
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment