summaryrefslogtreecommitdiff
path: root/include/private/sapp_timer_private.h
diff options
context:
space:
mode:
authoryangwei <[email protected]>2023-07-23 13:12:37 +0800
committeryangwei <[email protected]>2023-07-23 13:12:37 +0800
commit6a8be56de169bd79ed0e43afcc05ab96829a40a9 (patch)
tree2c463a33eab1b835f493781c8a7280a0a00b2c6a /include/private/sapp_timer_private.h
parentee48aae42e59e9e79df58ca0e06c342ff06e49e8 (diff)
📃 docs(clean redundancy code): 移除已注释代码,和直接放在头文件目录的event2.h
Diffstat (limited to 'include/private/sapp_timer_private.h')
-rw-r--r--include/private/sapp_timer_private.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/include/private/sapp_timer_private.h b/include/private/sapp_timer_private.h
index ad07b99..cbb92a8 100644
--- a/include/private/sapp_timer_private.h
+++ b/include/private/sapp_timer_private.h
@@ -5,10 +5,9 @@
extern "C" {
#endif
+#include <pthread.h>
#include "support/MESA_atomic.h"
#include "sapp_timer.h"
-#include "support/event2/event.h"
-#include "support/event2/event_struct.h"
/* NOTE: the two effective scope options are conflict, can't use as same time */
enum st_ef_scope_t{
@@ -16,29 +15,34 @@ enum st_ef_scope_t{
STO_EFFECTIVE_SCOPE_PKT_PROCESS_THREADS = 2,
};
-
+#ifdef LIBEVENT_ENABLED
+#include "support/event2/event.h"
+#endif
/*
NOTE:
- 1.ÿ���߳�ֻ��һ��ev_base, ����ǰ������߳�����, ����thread_cnt��, ���ԺͶ����߳�һ����.
- 2.add, newֻ����event�����̵߳���, ����ֻ�ڵ�ǰ�߳���Ч.
+ 1.ÿ���߳�ֻ��һ��ev_base, ����ǰ������߳�����, ����thread_cnt��, ���ԺͶ����߳�һ����.
+ 2.add, newֻ����event�����̵߳���, ����ֻ�ڵ�ǰ�߳���Ч.
*/
typedef struct{
volatile MESA_ATOMIC_T running;
enum st_ef_scope_t effective_mode;
+#ifdef LIBEVENT_ENABLED
struct event_base *libev_base;
- //struct event *libev_event[SAPP_MAX_THREADS+1];
+#endif
pthread_t effective_thread_pid;
int effective_thread_index;
int event_cnt;
- //int thread_cnt; /* sappƽ̨ʵ�ʲ����߳���, �����stand_alone�߳�, ��̶��洢�����һ��index, ��SAPP_TIMER_MAX_THREADS */
+ //int thread_cnt; /* sappƽ̨ʵ�ʲ����߳���, �����stand_alone�߳�, ��̶��洢�����һ��index, ��SAPP_TIMER_MAX_THREADS */
}sapp_timer_handle_inner_t;
-/* event��Ҫʹ��set_opt���ø��ֲ���, �ýṹ�彫��׼struct event��װ, �洢��ز��� */
+/* event��Ҫʹ��set_opt���ø��ֲ���, �ýṹ�彫��׼struct event��װ, �洢��ز��� */
typedef struct{
- struct event *libev_event;
sapp_timer_handle_inner_t *timer_handle;
+#ifdef LIBEVENT_ENABLED
+ struct event *libev_event;
event_callback_fn libev_cb_fun;
+#endif
sapp_timer_cbfun_t *sapp_plug_cb_fun;
void *user_arg;
struct timeval tval;