Lines Matching refs:aa

23 	struct add_arg *aa = arg;  in add()  local
25 if (aa->delay > 0) { in add()
26 nng_msleep(aa->delay); in add()
28 nng_mtx_lock(aa->mx); in add()
29 aa->cnt++; in add()
30 nng_cv_wake(aa->cv); in add()
31 nng_mtx_unlock(aa->mx); in add()
98 struct add_arg aa; in test_thread() local
100 NUTS_PASS(nng_mtx_alloc(&aa.mx)); in test_thread()
101 NUTS_PASS(nng_cv_alloc(&aa.cv, aa.mx)); in test_thread()
102 aa.cnt = 0; in test_thread()
103 aa.delay = 0; in test_thread()
105 NUTS_PASS(nng_thread_create(&thr, add, &aa)); in test_thread()
107 NUTS_TRUE(aa.cnt == 1); in test_thread()
109 nng_cv_free(aa.cv); in test_thread()
110 nng_mtx_free(aa.mx); in test_thread()
117 struct add_arg aa; in test_cond_var() local
119 NUTS_PASS(nng_mtx_alloc(&aa.mx)); in test_cond_var()
120 NUTS_PASS(nng_cv_alloc(&aa.cv, aa.mx)); in test_cond_var()
121 aa.cnt = 0; in test_cond_var()
122 aa.delay = 0; in test_cond_var()
124 NUTS_PASS(nng_thread_create(&thr, add, &aa)); in test_cond_var()
126 nng_mtx_lock(aa.mx); in test_cond_var()
127 while (aa.cnt == 0) { in test_cond_var()
128 nng_cv_wait(aa.cv); in test_cond_var()
130 nng_mtx_unlock(aa.mx); in test_cond_var()
132 NUTS_TRUE(aa.cnt == 1); in test_cond_var()
134 nng_cv_free(aa.cv); in test_cond_var()
135 nng_mtx_free(aa.mx); in test_cond_var()
142 struct add_arg aa; in test_cond_wake() local
145 NUTS_PASS(nng_mtx_alloc(&aa.mx)); in test_cond_wake()
146 NUTS_PASS(nng_cv_alloc(&aa.cv, aa.mx)); in test_cond_wake()
147 aa.cnt = 0; in test_cond_wake()
148 aa.delay = 200; in test_cond_wake()
152 NUTS_PASS(nng_thread_create(&thr, add, &aa)); in test_cond_wake()
154 nng_mtx_lock(aa.mx); in test_cond_wake()
155 nng_cv_until(aa.cv, now + 500); in test_cond_wake()
156 nng_mtx_unlock(aa.mx); in test_cond_wake()
162 nng_cv_free(aa.cv); in test_cond_wake()
163 nng_mtx_free(aa.mx); in test_cond_wake()
169 struct add_arg aa; in test_cond_until() local
172 NUTS_PASS(nng_mtx_alloc(&aa.mx)); in test_cond_until()
173 NUTS_PASS(nng_cv_alloc(&aa.cv, aa.mx)); in test_cond_until()
174 aa.cnt = 0; in test_cond_until()
175 aa.delay = 0; in test_cond_until()
178 nng_mtx_lock(aa.mx); in test_cond_until()
179 nng_cv_until(aa.cv, now + 100); in test_cond_until()
180 nng_mtx_unlock(aa.mx); in test_cond_until()
191 nng_cv_free(aa.cv); in test_cond_until()
192 nng_mtx_free(aa.mx); in test_cond_until()