示例#1
0
// forwards
static void sb_timer_key_dtor(void *pp_queue);

// globals
static Timer_TLE_Type   *gp_timer_head = NULL;
static Timer_TLE_Type   *gp_timer_tail = NULL;
static SB_Slot_Mgr      *gp_timer_tle_mgr = NULL;
static Timer_TLE_Type   *gp_timer_tles = NULL;
static SB_Timer_Thread  *gp_timer_thr = NULL;
static bool              gv_timer_alloc = true;
static SB_Thread::ECM    gv_timer_mutex("mutex-gv_timer_mutex");
static struct itimerval  gv_timer_to;
static SB_Ts_Lmap        gv_timer_tpop_map("map-timer-tpop");
static SB_Ts_Lmap        gv_timer_tpop_tid_map("map-timer-tpop-tid");
static int               gv_timer_tls_inx =
                           SB_create_tls_key(sb_timer_key_dtor,
                                             "timer-compq");


// forwards
static void            sb_timer_comp_q_print(SB_Timer_Comp_Queue *pp_comp_q);
static bool            sb_timer_setitimer(const char *pp_where, SB_To pv_to);
static void            sb_timer_setitimer_retry(const char *pp_where,
                                                SB_To       pv_to);
static void            sb_timer_timer_list_complete(const char *pp_where);
static void            sb_timer_timer_list_print();
static Timer_TLE_Type *sb_timer_tle_alloc(const char          *pp_where,
                                          Timer_TLE_Kind_Type  pv_kind);
static void            sb_timer_tle_free(Timer_TLE_Type *pp_tle);
static void            sb_timer_tle_insert(const char     *pp_where,
                                           SB_To           pv_to,
                                           Timer_TLE_Type *pp_tle);
示例#2
0
static pthread_key_t sb_trace_key_init() {
    pthread_key_t lv_key;

    lv_key = SB_create_tls_key(sb_trace_key_dtor, "otrace_sigset");
    return lv_key;
}
  0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, // e
  0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80  // f
};
SB_Lmap          SB_Ms_Event_Mgr::ca_reg_map[SB_Ms_Event_Mgr::EVENT_MAX];
SB_D_Queue       SB_Ms_Event_Mgr::cv_all_list(QID_EVENT_MGR, "q-event-mgr-all-list-event-mgr");
SB_Lmap          SB_Ms_Event_Mgr::cv_all_map("map-event-mgr-all");
SB_Ts_Imap       SB_Ms_Event_Mgr::cv_group_map("map-event-mgr-group");
SB_Imap          SB_Ms_Event_Mgr::cv_pin_map("map-event-mgr-pin");
SB_Thread::MSL   SB_Ms_Event_Mgr::cv_sl_map("sl-SB_Ms_Event_Mgr::cv_sl_map");
bool             SB_Ms_Event_Mgr::cv_trace_events = false;

SB_Ms_Event_Mgr *SB_Ms_Tl_Event_Mgr::cp_gmgr = NULL;
SB_Thread::MSL   SB_Ms_Tl_Event_Mgr::cv_sl;
bool             SB_Ms_Tl_Event_Mgr::cv_ret_gmgr = false;
int              SB_Ms_Tl_Event_Mgr::cv_tls_inx =
                   SB_create_tls_key(dtor, "eventmgr-mgr");
bool             SB_Ms_Tl_Event_Mgr::cv_trace_events = false;

#ifndef USE_SB_INLINE
#include "mseventmgr.inl"
#endif


//
// Purpose: constructor event-manager
//
SB_Ms_Event_Mgr::SB_Ms_Event_Mgr(long pv_id, int pv_tls_inx)
: ip_waiter_next(NULL), ip_waiter_prev(NULL),
  iv_awake(0), iv_awake_event(0), iv_mutex_locked(false), iv_replies(0),
  iv_tls_inx(pv_tls_inx),
  iv_wait_start_time(0), iv_wait_us(0) {