Rename uc_thread_queue_get to uc_thread_queue_tryget, introduce
uc_thread_queue_get macro
This commit is contained in:
@@ -45,7 +45,7 @@ START_TEST (test_thread_queue_one_thread)
|
||||
for (i = 0; i < 51; i++) {
|
||||
struct uc_threadmsg *msg;
|
||||
struct thr_msg *my_msg;
|
||||
fail_if(uc_thread_queue_get(&queue, NULL, &msg) != 0);
|
||||
fail_if(uc_thread_queue_get(&queue, &msg) != 0);
|
||||
my_msg = (struct thr_msg *)msg;
|
||||
fail_if(my_msg->a != i);
|
||||
free(my_msg);
|
||||
@@ -94,7 +94,7 @@ static void *test_thread_queue_reader_writer_func(void *arg)
|
||||
for (i = 0; i < READER_WRITER_NUM_MSG; i++) {
|
||||
struct uc_threadmsg *msg;
|
||||
struct thr_msg *my_msg;
|
||||
fail_if(uc_thread_queue_get(queue, NULL, &msg) != 0);
|
||||
fail_if(uc_thread_queue_get(queue, &msg) != 0);
|
||||
my_msg = (struct thr_msg *)msg;
|
||||
fail_if(my_msg->a != i);
|
||||
free(my_msg);
|
||||
@@ -188,7 +188,7 @@ START_TEST (test_thread_queue_multiple_writers)
|
||||
for (i = 0; i < READER_WRITER_NUM_MSG * 3; i++) {
|
||||
struct uc_threadmsg *msg;
|
||||
struct thr_msg *my_msg;
|
||||
fail_if(uc_thread_queue_get(&queue, NULL, &msg) != 0);
|
||||
fail_if(uc_thread_queue_get(&queue, &msg) != 0);
|
||||
my_msg = (struct thr_msg *)msg;
|
||||
|
||||
if (my_msg->a == READER_WRITER_NUM_MSG - 1)
|
||||
@@ -213,7 +213,7 @@ START_TEST (test_thread_queue_timeout1)
|
||||
|
||||
fail_if(uc_thread_queue_init(&queue, 100) != 0);
|
||||
|
||||
fail_if(uc_thread_queue_get(&queue, &timeout, &msg) != ETIMEDOUT);
|
||||
fail_if(uc_thread_queue_tryget(&queue, &timeout, &msg) != ETIMEDOUT);
|
||||
uc_thread_queue_destroy(&queue, NULL);
|
||||
|
||||
END_TEST
|
||||
@@ -225,8 +225,8 @@ void *thread_test_thread_queue_timeout2(void *arg)
|
||||
struct thr_msg *my_msg;
|
||||
struct timespec timeout = {0, 2000};
|
||||
|
||||
fail_if(uc_thread_queue_get(queue, &timeout, &msg) != 0);
|
||||
fail_if(uc_thread_queue_get(queue, &timeout, &msg) != ETIMEDOUT);
|
||||
fail_if(uc_thread_queue_tryget(queue, &timeout, &msg) != 0);
|
||||
fail_if(uc_thread_queue_tryget(queue, &timeout, &msg) != ETIMEDOUT);
|
||||
|
||||
my_msg = (struct thr_msg *)msg;
|
||||
fail_if(my_msg->b != 12345);
|
||||
|
||||
Reference in New Issue
Block a user