1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-07 03:22:57 +03:00

MCOL-513 Modify ThreadPool to have a join() method

This commit is contained in:
David Hall
2017-01-27 15:53:11 -06:00
parent e2d66222cd
commit c4742b8363
2 changed files with 44 additions and 12 deletions

View File

@@ -60,6 +60,7 @@ class ThreadPool
{
public:
typedef boost::function0<void> Functor_T;
typedef pair<int64_t, Functor_T> PoolFunction_T;
/*********************************************
* ctor/dtor
@@ -132,7 +133,7 @@ public:
* queueSize tasks already waiting, invoke() will block until a slot in the
* queue comes free.
*/
EXPORT void invoke(const Functor_T &threadfunc);
EXPORT int64_t invoke(const Functor_T &threadfunc);
/** @brief stop the threads
*/
@@ -142,7 +143,11 @@ public:
*/
EXPORT void wait();
/** @brief for use in debugging
/** @brief Wait for a specific thread
*/
EXPORT void join(uint64_t thrHandle);
/** @brief for use in debugging
*/
EXPORT void dump();
@@ -155,7 +160,7 @@ private:
/** @brief add a functor to the list
*/
void addFunctor(const Functor_T &func);
int64_t addFunctor(const Functor_T &func);
/** @brief thread entry point
*/
@@ -191,7 +196,7 @@ private:
size_t fMaxThreads;
size_t fQueueSize;
typedef std::list<Functor_T> Container_T;
typedef std::list<PoolFunction_T> Container_T;
Container_T fWaitingFunctors;
Container_T::iterator fNextFunctor;
// Functor_T * fThreadCreated;
@@ -206,6 +211,7 @@ private:
long fGeneralErrors;
long fFunctorErrors;
uint32_t waitingFunctorsSize;
uint64_t fNextHandle;
};