Lines Matching defs:p_disp
67 p_disp - Pointer to Dispatcher object
78 cl_dispatcher_t *p_disp = (cl_dispatcher_t *) context;
80 cl_spinlock_acquire(&p_disp->lock);
83 while (cl_qlist_count(&p_disp->msg_fifo)) {
86 (cl_disp_msg_t *) cl_qlist_remove_head(&p_disp->msg_fifo);
89 p_disp->last_msg_queue_time_us =
97 cl_spinlock_release(&p_disp->lock);
112 cl_spinlock_acquire(&p_disp->lock);
115 cl_qpool_put(&p_disp->msg_pool, (cl_pool_item_t *) p_msg);
118 cl_spinlock_release(&p_disp->lock);
121 void cl_disp_construct(IN cl_dispatcher_t * const p_disp)
123 CL_ASSERT(p_disp);
125 cl_qlist_init(&p_disp->reg_list);
126 cl_ptr_vector_construct(&p_disp->reg_vec);
127 cl_qlist_init(&p_disp->msg_fifo);
128 cl_spinlock_construct(&p_disp->lock);
129 cl_qpool_construct(&p_disp->msg_pool);
132 void cl_disp_shutdown(IN cl_dispatcher_t * const p_disp)
134 CL_ASSERT(p_disp);
137 cl_thread_pool_destroy(&p_disp->worker_threads);
140 __cl_disp_worker(p_disp);
143 while (!cl_is_qlist_empty(&p_disp->reg_list))
144 free(cl_qlist_remove_head(&p_disp->reg_list));
147 void cl_disp_destroy(IN cl_dispatcher_t * const p_disp)
149 CL_ASSERT(p_disp);
151 cl_spinlock_destroy(&p_disp->lock);
153 cl_qpool_destroy(&p_disp->msg_pool);
155 cl_ptr_vector_destroy(&p_disp->reg_vec);
158 cl_status_t cl_disp_init(IN cl_dispatcher_t * const p_disp,
164 CL_ASSERT(p_disp);
166 cl_disp_construct(p_disp);
168 status = cl_spinlock_init(&p_disp->lock);
170 cl_disp_destroy(p_disp);
175 status = cl_qpool_init(&p_disp->msg_pool, CL_DISP_INITIAL_MSG_COUNT,
179 cl_disp_destroy(p_disp);
183 status = cl_ptr_vector_init(&p_disp->reg_vec, CL_DISP_INITIAL_REG_COUNT,
186 cl_disp_destroy(p_disp);
190 status = cl_thread_pool_init(&p_disp->worker_threads, thread_count,
191 __cl_disp_worker, p_disp, name);
193 cl_disp_destroy(p_disp);
198 cl_disp_reg_handle_t cl_disp_register(IN cl_dispatcher_t * const p_disp,
207 CL_ASSERT(p_disp);
210 cl_spinlock_acquire(&p_disp->lock);
212 (msg_id < cl_ptr_vector_get_size(&p_disp->reg_vec)) &&
213 (cl_ptr_vector_get(&p_disp->reg_vec, msg_id))) {
214 cl_spinlock_release(&p_disp->lock);
221 cl_spinlock_release(&p_disp->lock);
227 p_reg->p_disp = p_disp;
234 cl_qlist_insert_tail(&p_disp->reg_list, (cl_list_item_t *) p_reg);
239 status = cl_ptr_vector_set(&p_disp->reg_vec, msg_id, p_reg);
242 cl_spinlock_release(&p_disp->lock);
247 cl_spinlock_release(&p_disp->lock);
255 cl_dispatcher_t *p_disp;
261 p_disp = p_reg->p_disp;
262 CL_ASSERT(p_disp);
264 cl_spinlock_acquire(&p_disp->lock);
271 cl_ptr_vector_get_size(&p_disp->reg_vec));
272 cl_ptr_vector_set(&p_disp->reg_vec, p_reg->msg_id, NULL);
274 cl_spinlock_release(&p_disp->lock);
279 cl_spinlock_acquire(&p_disp->lock);
281 cl_qlist_remove_item(&p_disp->reg_list, (cl_list_item_t *) p_reg);
285 cl_spinlock_release(&p_disp->lock);
296 cl_dispatcher_t *p_disp;
299 p_disp = handle->p_disp;
300 CL_ASSERT(p_disp);
303 cl_spinlock_acquire(&p_disp->lock);
305 if (cl_ptr_vector_get_size(&p_disp->reg_vec) <= msg_id) {
306 cl_spinlock_release(&p_disp->lock);
310 p_dest_reg = cl_ptr_vector_get(&p_disp->reg_vec, msg_id);
312 cl_spinlock_release(&p_disp->lock);
317 p_msg = (cl_disp_msg_t *) cl_qpool_get(&p_disp->msg_pool);
319 cl_spinlock_release(&p_disp->lock);
342 cl_qlist_insert_tail(&p_disp->msg_fifo, (cl_list_item_t *) p_msg);
343 cl_spinlock_release(&p_disp->lock);
346 cl_thread_pool_signal(&p_disp->worker_threads);
354 cl_dispatcher_t *p_disp = ((cl_disp_reg_info_t *) handle)->p_disp;
356 cl_spinlock_acquire(&p_disp->lock);
360 p_disp->last_msg_queue_time_us / 1000;
363 *p_num_queued_msgs = cl_qlist_count(&p_disp->msg_fifo);
365 cl_spinlock_release(&p_disp->lock);