diff options
| author | lijia <[email protected]> | 2019-06-05 18:42:52 +0800 |
|---|---|---|
| committer | lijia <[email protected]> | 2019-06-05 18:42:52 +0800 |
| commit | cb2152f52cdeb84c99d5ec53e018e5ac4a6fc301 (patch) | |
| tree | 674039fd44130ff694b489bddde035c1d5ef0eb1 /include/private/sapp_timer_private.h | |
| parent | 49996782de45cb78fcdc824c506a99f4d3b7126a (diff) | |
1-增加定时器, 基于Libevent实现, 依赖库静态链接到sapp;
2-增加平台运行状态;
3-插件配置文件合并, 避免经常打开多个.inf的情况,
将原来的三个:conflist_platform.inf, conflist_protocol.inf, conflist_business.inf改为一个conflist.inf,
Diffstat (limited to 'include/private/sapp_timer_private.h')
| -rw-r--r-- | include/private/sapp_timer_private.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/include/private/sapp_timer_private.h b/include/private/sapp_timer_private.h new file mode 100644 index 0000000..ac5c74c --- /dev/null +++ b/include/private/sapp_timer_private.h @@ -0,0 +1,52 @@ +#ifndef _SAPP_TIMER_PRIVATE_H_ +#define _SAPP_TIMER_PRIVATE_H_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#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{ + STO_EFFECTIVE_SCOPE_STANDALONE_THREAD = 1, + STO_EFFECTIVE_SCOPE_PKT_PROCESS_THREADS = 2, +}; + + +/* + NOTE: + 1.ÿ���߳�ֻ��һ��ev_base, ����ǰ������߳�����, ����thread_cnt��, ���ԺͶ����߳�һ����. + 2.add, newֻ����event�����̵߳���, ����ֻ�ڵ�ǰ�߳���Ч. +*/ +typedef struct{ + volatile MESA_ATOMIC_T running; + enum st_ef_scope_t effective_mode; + struct event_base *libev_base; + //struct event *libev_event[SAPP_MAX_THREADS+1]; + pthread_t effective_thread_pid; + int effective_thread_index; + + //int thread_cnt; /* sappƽ̨ʵ�ʲ����߳���, �����stand_alone�߳�, ��̶��洢�����һ��index, ��SAPP_TIMER_MAX_THREADS */ +}sapp_timer_handle_inner_t; + +/* event��Ҫʹ��set_opt���ø��ֲ���, �ýṹ�彫��struct event��װ, �洢��ز��� */ +typedef struct{ + struct event *libev_event; + sapp_timer_handle_inner_t *timer_handle; + event_callback_fn libev_cb_fun; + sapp_timer_cbfun_t *sapp_plug_cb_fun; + void *user_arg; + struct timeval tval; + int callback_count; // to do +}sapp_timer_event_inner_t; + +#ifdef __cplusplus +} +#endif + +#endif + |
