diff --git a/src/kernel/Communicator.cc b/src/kernel/Communicator.cc index 8e554b5117..1939b76fe6 100644 --- a/src/kernel/Communicator.cc +++ b/src/kernel/Communicator.cc @@ -1686,6 +1686,11 @@ int Communicator::sleep(SleepSession *session) return -1; } +int Communicator::is_handler_thread() +{ + return thrdpool_in_pool(this->thrdpool); +} + extern "C" void __thrdpool_schedule(const struct thrdpool_task *, void *, thrdpool_t *); diff --git a/src/kernel/Communicator.h b/src/kernel/Communicator.h index e858d4a103..5a4e96d98d 100644 --- a/src/kernel/Communicator.h +++ b/src/kernel/Communicator.h @@ -27,10 +27,7 @@ #include #include #include "list.h" -#include "msgqueue.h" -#include "thrdpool.h" #include "poller.h" -#include "mpoller.h" class CommConnection { @@ -263,13 +260,13 @@ class Communicator void io_unbind(IOService *service); public: + int is_handler_thread(); int increase_handler_thread(); - int is_handler_thread() { return thrdpool_in_pool(this->thrdpool); } private: - msgqueue_t *queue; - mpoller_t *mpoller; - thrdpool_t *thrdpool; + struct __mpoller *mpoller; + struct __msgqueue *queue; + struct __thrdpool *thrdpool; int stop_flag; private: diff --git a/src/kernel/Executor.h b/src/kernel/Executor.h index 9181bf51dc..e43064190d 100644 --- a/src/kernel/Executor.h +++ b/src/kernel/Executor.h @@ -22,7 +22,6 @@ #include #include #include "list.h" -#include "thrdpool.h" class ExecQueue { @@ -69,7 +68,7 @@ class Executor int request(ExecSession *session, ExecQueue *queue); private: - thrdpool_t *thrdpool; + struct __thrdpool *thrdpool; private: static void executor_thread_routine(void *context); diff --git a/src/kernel/SleepRequest.h b/src/kernel/SleepRequest.h index c625d96835..f2f1ed3010 100644 --- a/src/kernel/SleepRequest.h +++ b/src/kernel/SleepRequest.h @@ -20,6 +20,7 @@ #define _SLEEPREQUEST_H_ #include "SubTask.h" +#include "Communicator.h" #include "CommScheduler.h" class SleepRequest : public SubTask, public SleepSession diff --git a/src/kernel/thrdpool.c b/src/kernel/thrdpool.c index 9419033211..6ec5b0e976 100644 --- a/src/kernel/thrdpool.c +++ b/src/kernel/thrdpool.c @@ -176,7 +176,7 @@ thrdpool_t *thrdpool_create(size_t nthreads, size_t stacksize) thrdpool_t *pool; int ret; - pool = (struct __thrdpool *)malloc(sizeof (struct __thrdpool)); + pool = (thrdpool_t *)malloc(sizeof (thrdpool_t)); if (pool) { if (__thrdpool_init_locks(pool) >= 0) diff --git a/src/kernel/thrdpool.h b/src/kernel/thrdpool.h index ac8f722b92..71f4b2dc1c 100644 --- a/src/kernel/thrdpool.h +++ b/src/kernel/thrdpool.h @@ -41,8 +41,8 @@ extern "C" * A thread task can be scheduled by another task, which is very important, * even if the pool is being destroyed. Because thread task is hard to know * what's happening to the pool. - * The thread pool can also be destroyed by a thread task. Although this seems - * to be strange, it's very logical. Destroying thread pool in thread task + * The thread pool can also be destroyed by a thread task. This may sound + * strange, but it's very logical. Destroying thread pool in thread task * does not end the task thread. It'll run till the end of task. */