| 76 | } |
| 77 | |
| 78 | static void wait_safely(struct rt_completion *completion) |
| 79 | { |
| 80 | int try_times = 3; |
| 81 | rt_err_t error; |
| 82 | do |
| 83 | { |
| 84 | /* wait for one tick, to add more random */ |
| 85 | error = rt_completion_wait_flags(completion, 1, RT_INTERRUPTIBLE); |
| 86 | if (error) |
| 87 | { |
| 88 | if (error == -RT_ETIMEOUT || error == -RT_EINTR) |
| 89 | { |
| 90 | _async_intr_count++; |
| 91 | } |
| 92 | else |
| 93 | { |
| 94 | LOG_I("Async event %d\n", error); |
| 95 | uassert_true(0); |
| 96 | } |
| 97 | rt_thread_yield(); |
| 98 | } |
| 99 | else |
| 100 | { |
| 101 | break; |
| 102 | } |
| 103 | } while (try_times--); |
| 104 | |
| 105 | if (error != RT_EOK) |
| 106 | { |
| 107 | uassert_true(error == RT_EOK); |
| 108 | _test_thread_exit_failure("wait failed"); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | static void producer_thread_entry(void *parameter) |
| 113 | { |
no test coverage detected