diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2017-10-12 17:09:41 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2017-10-12 18:47:12 +0300 |
commit | ae48a9d61cafaee49fd1936e83e0e919dec5fa2d (patch) | |
tree | b74f3f250c35c799047647f2a62d4dd401a99120 /accel-pppd/triton/triton_p.h | |
parent | 7be5b657cd57f61971680087e606f36e36605144 (diff) | |
download | accel-ppp-ae48a9d61cafaee49fd1936e83e0e919dec5fa2d.tar.gz accel-ppp-ae48a9d61cafaee49fd1936e83e0e919dec5fa2d.zip |
triton: rewrited context sleeping implementation
Instead of entering working thread into sleep triton saves machine context and stack on sleep and restores context/stack on wakeup.
This saves costly new thread allocation.
Diffstat (limited to 'accel-pppd/triton/triton_p.h')
-rw-r--r-- | accel-pppd/triton/triton_p.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/accel-pppd/triton/triton_p.h b/accel-pppd/triton/triton_p.h index 6c9f884d..a16ef98e 100644 --- a/accel-pppd/triton/triton_p.h +++ b/accel-pppd/triton/triton_p.h @@ -2,6 +2,7 @@ #define TRITON_P_H #include <pthread.h> +#include <ucontext.h> #include <sys/epoll.h> #include "triton.h" @@ -18,6 +19,7 @@ struct _triton_thread_t struct _triton_context_t *ctx; pthread_mutex_t sleep_lock; pthread_cond_t sleep_cond; + struct list_head wakeup_list; }; struct _triton_context_t @@ -43,6 +45,8 @@ struct _triton_context_t int priority; int refs; + ucontext_t *uc; + struct triton_context_t *ud; void *bf_arg; }; |