#include #include #include static struct nn_mutex mutex; static struct nn_cond cond; static struct nn_thread thread; static nn_thread_result NNWT_THREADCALL test_thread(void *userdata) { (void)userdata; nn_mutex_lock(&mutex); nn_cond_wait(&cond, &mutex); nn_mutex_unlock(&mutex); return 0; } s32 main(void) { if (!nn_common_init(NULL)) return EXIT_FAILURE; nn_mutex_init(&mutex); nn_cond_init(&cond); nn_thread_create(&thread, test_thread, NULL); nn_thread_sleep(NNWT_TS_FROM_USEC(1000000)); nn_mutex_lock(&mutex); nn_cond_signal(&cond); // cond_wait() won't return until we unlock here. nn_mutex_unlock(&mutex); nn_thread_join(&thread); nn_common_close(); return EXIT_SUCCESS; }