From 0e36396012e5d7153346af069ba02525d264e256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Wed, 8 Nov 2023 15:23:58 +0900 Subject: [PATCH] =?UTF-8?q?=E5=84=AA=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tcpool.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/tcpool.h b/tcpool.h index e57dcb4..371bf82 100644 --- a/tcpool.h +++ b/tcpool.h @@ -22,6 +22,18 @@ #define TCPOOL_THREAD_TIMER_T_SZ 1024 #endif +#define TCPOOL_THREAD_TIMER_T_HEAD_SZ ( \ + sizeof(uint32_t) \ + +sizeof(int) \ + +sizeof(time_t) \ + +sizeof(pthread_rwlock_t) \ + +2*sizeof(pthread_t) \ + +2*sizeof(pthread_cond_t) \ + +2*sizeof(pthread_mutex_t) \ + +sizeof(pthread_rwlock_t) \ + +2*sizeof(uint8_t) \ + ) + #ifndef TCPOOL_THREADCNT #define TCPOOL_THREADCNT 32 #endif @@ -32,16 +44,8 @@ #ifndef TCPOOL_THREAD_CONTEXT #define TCPOOL_THREAD_CONTEXT uint8_t __padding[ \ - TCPOOL_THREAD_TIMER_T_SZ \ - -sizeof(uint32_t) \ - -sizeof(int) \ - -sizeof(time_t) \ - -sizeof(pthread_rwlock_t) \ - -2*sizeof(pthread_t) \ - -2*sizeof(pthread_cond_t) \ - -2*sizeof(pthread_mutex_t) \ - -sizeof(pthread_rwlock_t) \ - -2*sizeof(uint8_t) \ + TCPOOL_THREAD_TIMER_T_SZ \ + -TCPOOL_THREAD_TIMER_T_HEAD_SZ \ ] #endif