Commit graph

4 commits

Author SHA1 Message Date
Vladislav Vaintroub
bada05a883 tpool - implement post-task callback (for Innodb debugging) 2020-01-12 19:08:02 +01:00
Vladislav Vaintroub
86407a59b3 MDEV-16264 - Fix assertion `m_queue.empty() && !m_tasks_running' in tpool::task_group destructor
This particular assertion happened when shutting down Innodb IO.IO shutdown properly waits for all IOs to finish


However there is a race condition -
right after releasing last IO slot and before decrementing task count
in group, pending_io_count will be 0, but tasks_running will be 1,
leading to assertion.

The fix is to make task_group destructor to wait for last running task
to finish.
2019-11-25 17:10:01 +01:00
Vladislav Vaintroub
c233d406cb Fix compile error on centos6. it does not like std::this_thread::sleep()
Simplify task_group destructor.
No tasks must be running or queued into task group is being destroyed.
2019-11-15 23:51:49 +01:00
Vladislav Vaintroub
00ee8d85c9 MDEV-16264: Add threadpool library
The library is capable of
- asynchronous execution of tasks (and optionally waiting for them)
- asynchronous file IO
  This is implemented using libaio on Linux and completion ports on
  Windows. Elsewhere, async io is "simulated", which means worker threads
  are performing synchronous IO.
- timers, scheduling work asynchronously in some point of the future.
  Also periodic timers are implemented.
2019-11-15 16:50:22 +01:00