Lines Matching refs:this
58 struct nce_status_t *this; in nce_init() local
60 this = calloc(1, sizeof(struct nce_status_t)); in nce_init()
62 if (this == NULL) { /* LCOV_EXCL_BR_LINE */ in nce_init()
65 this->cpu_halted = true; in nce_init()
66 this->terminate = false; in nce_init()
68 NSI_SAFE_CALL(pthread_cond_init(&this->cond_cpu, NULL)); in nce_init()
69 NSI_SAFE_CALL(pthread_mutex_init(&this->mtx_cpu, NULL)); in nce_init()
71 return (void *)this; in nce_init()
85 struct nce_status_t *this = (struct nce_status_t *)this_arg; in nce_terminate() local
94 if (this == NULL || this->cpu_halted) { in nce_terminate()
104 } else if (this->terminate == false) { in nce_terminate()
106 this->terminate = true; in nce_terminate()
108 NSI_SAFE_CALL(pthread_mutex_lock(&this->mtx_cpu)); in nce_terminate()
110 this->cpu_halted = true; in nce_terminate()
112 NSI_SAFE_CALL(pthread_cond_broadcast(&this->cond_cpu)); in nce_terminate()
113 NSI_SAFE_CALL(pthread_mutex_unlock(&this->mtx_cpu)); in nce_terminate()
137 static void change_cpu_state_and_wait(struct nce_status_t *this, bool halted) in change_cpu_state_and_wait() argument
139 NSI_SAFE_CALL(pthread_mutex_lock(&this->mtx_cpu)); in change_cpu_state_and_wait()
143 this->cpu_halted = halted; in change_cpu_state_and_wait()
146 NSI_SAFE_CALL(pthread_cond_broadcast(&this->cond_cpu)); in change_cpu_state_and_wait()
156 while (this->cpu_halted == halted) { in change_cpu_state_and_wait()
158 pthread_cond_wait(&this->cond_cpu, &this->mtx_cpu); in change_cpu_state_and_wait()
163 NSI_SAFE_CALL(pthread_mutex_unlock(&this->mtx_cpu)); in change_cpu_state_and_wait()
171 struct nce_status_t *this = (struct nce_status_t *)this_arg; in sw_wrapper() local
174 NSI_SAFE_CALL(pthread_mutex_lock(&this->mtx_cpu)); in sw_wrapper()
175 NSI_SAFE_CALL(pthread_mutex_unlock(&this->mtx_cpu)); in sw_wrapper()
184 this->start_routine(); in sw_wrapper()
199 struct nce_status_t *this = (struct nce_status_t *)this_arg; in nce_boot_cpu() local
201 NSI_SAFE_CALL(pthread_mutex_lock(&this->mtx_cpu)); in nce_boot_cpu()
203 this->cpu_halted = false; in nce_boot_cpu()
204 this->start_routine = start_routine; in nce_boot_cpu()
212 while (this->cpu_halted == false) { in nce_boot_cpu()
213 pthread_cond_wait(&this->cond_cpu, &this->mtx_cpu); in nce_boot_cpu()
215 NSI_SAFE_CALL(pthread_mutex_unlock(&this->mtx_cpu)); in nce_boot_cpu()
217 if (this->terminate) { in nce_boot_cpu()
233 struct nce_status_t *this = (struct nce_status_t *)this_arg; in nce_halt_cpu() local
235 if (this->cpu_halted == true) { in nce_halt_cpu()
239 change_cpu_state_and_wait(this, true); in nce_halt_cpu()
252 struct nce_status_t *this = (struct nce_status_t *)this_arg; in nce_wake_cpu() local
254 if (this->cpu_halted == false) { in nce_wake_cpu()
258 change_cpu_state_and_wait(this, false); in nce_wake_cpu()
264 if (this->terminate) { in nce_wake_cpu()
275 struct nce_status_t *this = (struct nce_status_t *)this_arg; in nce_is_cpu_running() local
277 if (this != NULL) { in nce_is_cpu_running()
278 return !this->cpu_halted; in nce_is_cpu_running()