summaryrefslogtreecommitdiff
path: root/libcr_ipc/tests/test_select.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcr_ipc/tests/test_select.c')
-rw-r--r--libcr_ipc/tests/test_select.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/libcr_ipc/tests/test_select.c b/libcr_ipc/tests/test_select.c
index f0a71a3..9b5d117 100644
--- a/libcr_ipc/tests/test_select.c
+++ b/libcr_ipc/tests/test_select.c
@@ -14,7 +14,7 @@ CR_CHAN_DECLARE(intchan, int);
intchan_t ch[10] = {0};
intchan_t fch = {0};
-COROUTINE cr_consumer(void *) {
+COROUTINE consumer_cr(void *) {
cr_begin();
struct cr_select_arg args[11];
@@ -53,15 +53,14 @@ COROUTINE cr_consumer(void *) {
test_assert(ret_arg == 0);
send = 890;
- args[0] = CR_SELECT_SEND(&fch, &send);
- args[1] = CR_SELECT_DEFAULT;
- ret_arg = cr_select_v(2, args);
+ ret_arg = cr_select_l(CR_SELECT_SEND(&fch, &send),
+ CR_SELECT_DEFAULT);
test_assert(ret_arg == 1);
cr_end();
}
-COROUTINE cr_producer(void *_n) {
+COROUTINE producer_cr(void *_n) {
int n = *(int *)_n;
cr_begin();
@@ -70,7 +69,7 @@ COROUTINE cr_producer(void *_n) {
cr_end();
}
-COROUTINE cr_final(void *) {
+COROUTINE final_cr(void *) {
cr_begin();
int ret = cr_chan_recv(&fch);
@@ -82,9 +81,9 @@ COROUTINE cr_final(void *) {
int main() {
for (int i = 0; i < 10; i++)
- coroutine_add("producer", cr_producer, &i);
- coroutine_add("consumer", cr_consumer, NULL);
- coroutine_add("final", cr_final, NULL);
+ coroutine_add("producer", producer_cr, &i);
+ coroutine_add("consumer", consumer_cr, NULL);
+ coroutine_add("final", final_cr, NULL);
coroutine_main();
return 0;
}