Lines Matching refs:this

130 static struct threads_table_el *ttable_get_element(struct nct_status_t *this, int index);
198 static void nct_let_run(struct nct_status_t *this, int next_allowed_th) in nct_let_run() argument
200 struct threads_table_el *tt_el = ttable_get_element(this, next_allowed_th); in nct_let_run()
204 this->currently_allowed_thread = next_allowed_th; in nct_let_run()
225 struct nct_status_t *this = (struct nct_status_t *)this_arg; in nct_swap_threads() local
226 int this_th_nbr = this->currently_allowed_thread; in nct_swap_threads()
227 struct threads_table_el *tt_el = ttable_get_element(this, this_th_nbr); in nct_swap_threads()
229 nct_let_run(this, next_allowed_thread_nbr); in nct_swap_threads()
258 struct nct_status_t *this = (struct nct_status_t *)this_arg; in nct_first_thread_start() local
260 nct_let_run(this, next_allowed_thread_nbr); in nct_first_thread_start()
272 const struct nct_status_t *this = tt_el->nct_status; in nct_thread_starter() local
282 if (!this->threads_table || this->terminate) { in nct_thread_starter()
290 this->fptr(tt_el->payload); in nct_thread_starter()
328 static struct threads_table_el *ttable_get_element(struct nct_status_t *this, int index) in ttable_get_element() argument
330 struct threads_table_el *threads_table = this->threads_table; in ttable_get_element()
332 if (index >= this->threads_table_size) { /* LCOV_EXCL_BR_LINE */ in ttable_get_element()
335 index, this->threads_table_size); /* LCOV_EXCL_LINE */ in ttable_get_element()
347 static int ttable_get_empty_slot(struct nct_status_t *this) in ttable_get_empty_slot() argument
349 struct threads_table_el *tt_el = this->threads_table; in ttable_get_empty_slot()
351 for (int i = 0; i < this->threads_table_size; i++, tt_el = tt_el->next) { in ttable_get_empty_slot()
372 tt_el = ttable_get_element(this, this->threads_table_size-1); in ttable_get_empty_slot()
375 this->threads_table_size += NCT_ALLOC_CHUNK_SIZE; in ttable_get_empty_slot()
380 return this->threads_table_size - NCT_ALLOC_CHUNK_SIZE; in ttable_get_empty_slot()
399 struct nct_status_t *this = (struct nct_status_t *)this_arg; in nct_new_thread() local
403 t_slot = ttable_get_empty_slot(this); in nct_new_thread()
404 tt_el = ttable_get_element(this, t_slot); in nct_new_thread()
408 tt_el->thead_cnt = this->thread_create_count++; in nct_new_thread()
410 tt_el->nct_status = this; in nct_new_thread()
437 struct nct_status_t *this; in nct_init() local
446 this = calloc(1, sizeof(struct nct_status_t)); in nct_init()
447 if (this == NULL) { /* LCOV_EXCL_BR_LINE */ in nct_init()
451 this->fptr = fptr; in nct_init()
452 this->thread_create_count = 0; in nct_init()
453 this->currently_allowed_thread = -1; in nct_init()
455 this->threads_table = calloc(NCT_ALLOC_CHUNK_SIZE, sizeof(struct threads_table_el)); in nct_init()
456 if (this->threads_table == NULL) { /* LCOV_EXCL_BR_LINE */ in nct_init()
460 this->threads_table_size = NCT_ALLOC_CHUNK_SIZE; in nct_init()
462 ttable_init_elements(this->threads_table, NCT_ALLOC_CHUNK_SIZE); in nct_init()
464 return (void *)this; in nct_init()
485 struct nct_status_t *this = (struct nct_status_t *)this_arg; in nct_clean_up() local
487 if (!this || !this->threads_table) { /* LCOV_EXCL_BR_LINE */ in nct_clean_up()
491 this->terminate = true; in nct_clean_up()
494 if (this->all_threads_released) { in nct_clean_up()
497 this->all_threads_released = true; in nct_clean_up()
499 struct threads_table_el *tt_el = this->threads_table; in nct_clean_up()
501 for (int i = 0; i < this->threads_table_size; i++, tt_el = tt_el->next) { in nct_clean_up()
536 struct nct_status_t *this = (struct nct_status_t *)this_arg; in nct_abort_thread() local
537 struct threads_table_el *tt_el = ttable_get_element(this, thread_idx); in nct_abort_thread()
539 if (thread_idx == this->currently_allowed_thread) { in nct_abort_thread()
563 struct nct_status_t *this = (struct nct_status_t *)this_arg; in nct_get_unique_thread_id() local
564 struct threads_table_el *tt_el = ttable_get_element(this, thread_idx); in nct_get_unique_thread_id()
571 struct nct_status_t *this = (struct nct_status_t *)this_arg; in nct_thread_name_set() local
572 struct threads_table_el *tt_el = ttable_get_element(this, thread_idx); in nct_thread_name_set()