45 const uint32_t objpool_subpools = OBJSUBPOOLS_MAX;
54 em_event_group_t egrp = egrp_idx2hdl(i);
56 egrp_elem = event_group_elem_get(egrp);
57 if (unlikely(!egrp_elem))
62 env_atomic64_set(&egrp_elem->post.atomic, 0);
63 env_atomic64_set(&egrp_elem->pre.atomic, 0);
66 ret = objpool_init(&event_group_pool->objpool, objpool_subpools);
71 egrp_elem = &event_group_tbl->
egrp_elem[i];
72 objpool_add(&event_group_pool->objpool, i % objpool_subpools,
80 event_group_alloc(
void)
85 egrp_pool_elem = objpool_rem(&
em_shm->event_group_pool.objpool,
87 if (unlikely(egrp_pool_elem == NULL))
90 egrp_elem = egrp_poolelem2egrp(egrp_pool_elem);
97 event_group_free(em_event_group_t event_group)
101 if (unlikely(egrp_elem == NULL))
104 objpool_add(&
em_shm->event_group_pool.objpool,
113 event_group_count(
void)
118 #define EGRP_INFO_HDR_FMT \
119 "Number of event groups: %d\n\n" \
120 "ID Ready Cnt(post) Gen Num-notif\n" \
121 "------------------------------------------\n%s\n"
123 #define EGRP_INFO_LEN 43
124 #define EGRP_INFO_FMT "%-10" PRI_EGRP "%-7c%-11d%-5d%-9d\n"
128 unsigned int egrp_num;
129 em_event_group_t egrp;
147 const int egrp_info_str_len = (egrp_num + 10) * EGRP_INFO_LEN + 1;
148 char egrp_info_str[egrp_info_str_len];
151 egrp_elem = event_group_elem_get(egrp);
153 if (unlikely(egrp_elem == NULL || !event_group_allocated(egrp_elem))) {
158 egrp_count.all = EM_ATOMIC_GET(&egrp_elem->post.atomic);
160 n_print = snprintf(egrp_info_str + len,
161 egrp_info_str_len - len,
163 egrp_elem->
ready ?
'Y' :
'N',
168 if (n_print >= egrp_info_str_len - len)
177 EM_PRINT(
"No event group!\n");
185 egrp_info_str[len] =
'\0';
186 EM_PRINT(EGRP_INFO_HDR_FMT, egrp_num, egrp_info_str);