/* If called from a HW thread, do the necessary clean up of this nce instance and return right away.  */
void nce_terminate(void *this_arg)
/* If called from a HW thread, do the necessary clean up of this nce instance and return right away.  */
void nce_terminate(void *this_arg)
{
	struct nce_status_t *this = (struct nce_status_t *)this_arg;
	if (this == NULL || this->cpu_halted) {
		return;
	} else if (this->terminate == false) {
		this->terminate = true;
		NSI_SAFE_CALL(pthread_mutex_lock(&this->mtx_cpu));
		this->cpu_halted = true;
		NSI_SAFE_CALL(pthread_cond_broadcast(&this->cond_cpu));
		NSI_SAFE_CALL(pthread_mutex_unlock(&this->mtx_cpu));
		while (1) {
			sleep(1);
		}
	}
}