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
bada05a8
Commit
bada05a8
authored
Jan 12, 2020
by
Vladislav Vaintroub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tpool - implement post-task callback (for Innodb debugging)
parent
90002480
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
1 deletion
+42
-1
storage/innobase/srv/srv0srv.cc
storage/innobase/srv/srv0srv.cc
+10
-0
tpool/task.cc
tpool/task.cc
+16
-0
tpool/task_group.cc
tpool/task_group.cc
+1
-0
tpool/tpool.h
tpool/tpool.h
+13
-0
tpool/tpool_generic.cc
tpool/tpool_generic.cc
+1
-1
tpool/tpool_win.cc
tpool/tpool_win.cc
+1
-0
No files found.
storage/innobase/srv/srv0srv.cc
View file @
bada05a8
...
...
@@ -714,6 +714,13 @@ static void thread_pool_thread_end()
}
#ifndef DBUG_OFF
static
void
dbug_after_task_callback
()
{
ut_ad
(
!
sync_check_iterate
(
sync_check
()));
}
#endif
void
srv_thread_pool_init
()
{
DBUG_ASSERT
(
!
srv_thread_pool
);
...
...
@@ -725,6 +732,9 @@ void srv_thread_pool_init()
#endif
srv_thread_pool
->
set_thread_callbacks
(
thread_pool_thread_init
,
thread_pool_thread_end
);
#ifndef DBUG_OFF
tpool
::
set_after_task_callback
(
dbug_after_task_callback
);
#endif
}
...
...
tpool/task.cc
View file @
bada05a8
...
...
@@ -21,6 +21,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/
namespace
tpool
{
#ifndef DBUG_OFF
static
callback_func_np
after_task_callback
;
void
set_after_task_callback
(
callback_func_np
cb
)
{
after_task_callback
=
cb
;
}
void
execute_after_task_callback
()
{
if
(
after_task_callback
)
after_task_callback
();
}
#endif
task
::
task
(
callback_func
func
,
void
*
arg
,
task_group
*
group
)
:
m_func
(
func
),
m_arg
(
arg
),
m_group
(
group
)
{}
...
...
@@ -35,6 +50,7 @@ namespace tpool
{
/* Execute directly. */
m_func
(
m_arg
);
dbug_execute_after_task_callback
();
release
();
}
}
...
...
tpool/task_group.cc
View file @
bada05a8
...
...
@@ -53,6 +53,7 @@ namespace tpool
if
(
t
)
{
t
->
m_func
(
t
->
m_arg
);
dbug_execute_after_task_callback
();
t
->
release
();
}
lk
.
lock
();
...
...
tpool/tpool.h
View file @
bada05a8
...
...
@@ -51,6 +51,7 @@ namespace tpool
Task callback function
*/
typedef
void
(
*
callback_func
)(
void
*
);
typedef
void
(
*
callback_func_np
)(
void
);
class
task
;
/** A class that can be used e.g. for
...
...
@@ -174,6 +175,18 @@ class thread_pool;
extern
aio
*
create_simulated_aio
(
thread_pool
*
tp
);
#ifndef DBUG_OFF
/*
This function is useful for debugging to make sure all mutexes are released
inside a task callback
*/
void
set_after_task_callback
(
callback_func_np
cb
);
void
execute_after_task_callback
();
#define dbug_execute_after_task_callback() execute_after_task_callback()
#else
#define dbug_execute_after_task_callback() do{}while(0)
#endif
class
thread_pool
{
protected:
...
...
tpool/tpool_generic.cc
View file @
bada05a8
...
...
@@ -293,7 +293,7 @@ class thread_pool_generic : public thread_pool
return
;
m_callback
(
m_data
);
dbug_execute_after_task_callback
();
m_running
=
false
;
if
(
m_pool
&&
m_period
)
...
...
tpool/tpool_win.cc
View file @
bada05a8
...
...
@@ -93,6 +93,7 @@ class thread_pool_win : public thread_pool
return
;
}
timer
->
m_func
(
timer
->
m_data
);
dbug_execute_after_task_callback
();
if
(
timer
->
m_period
)
timer
->
set_time
(
timer
->
m_period
,
timer
->
m_period
);
}
...
...
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