libuv 1.47.0.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4615 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-11-07 17:30:39 +00:00
parent 889773c38d
commit ee9cb63327
226 changed files with 6648 additions and 6444 deletions

View File

@ -32,49 +32,49 @@ static int timer_cb_called;
static void prepare_cb(uv_prepare_t* handle) {
ASSERT(0 == uv_prepare_stop(&prepare_handle));
ASSERT(0 == prepare_cb_called);
ASSERT(1 == check_cb_called);
ASSERT(0 == timer_cb_called);
ASSERT_OK(uv_prepare_stop(&prepare_handle));
ASSERT_OK(prepare_cb_called);
ASSERT_EQ(1, check_cb_called);
ASSERT_OK(timer_cb_called);
prepare_cb_called++;
}
static void timer_cb(uv_timer_t* handle) {
ASSERT(0 == uv_timer_stop(&timer_handle));
ASSERT(1 == prepare_cb_called);
ASSERT(1 == check_cb_called);
ASSERT(0 == timer_cb_called);
ASSERT_OK(uv_timer_stop(&timer_handle));
ASSERT_EQ(1, prepare_cb_called);
ASSERT_EQ(1, check_cb_called);
ASSERT_OK(timer_cb_called);
timer_cb_called++;
}
static void check_cb(uv_check_t* handle) {
ASSERT(0 == uv_check_stop(&check_handle));
ASSERT(0 == uv_timer_stop(&timer_handle)); /* Runs before timer_cb. */
ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 50, 0));
ASSERT(0 == uv_prepare_start(&prepare_handle, prepare_cb));
ASSERT(0 == prepare_cb_called);
ASSERT(0 == check_cb_called);
ASSERT(0 == timer_cb_called);
ASSERT_OK(uv_check_stop(&check_handle));
ASSERT_OK(uv_timer_stop(&timer_handle)); /* Runs before timer_cb. */
ASSERT_OK(uv_timer_start(&timer_handle, timer_cb, 50, 0));
ASSERT_OK(uv_prepare_start(&prepare_handle, prepare_cb));
ASSERT_OK(prepare_cb_called);
ASSERT_OK(check_cb_called);
ASSERT_OK(timer_cb_called);
check_cb_called++;
}
TEST_IMPL(timer_from_check) {
ASSERT(0 == uv_prepare_init(uv_default_loop(), &prepare_handle));
ASSERT(0 == uv_check_init(uv_default_loop(), &check_handle));
ASSERT(0 == uv_check_start(&check_handle, check_cb));
ASSERT(0 == uv_timer_init(uv_default_loop(), &timer_handle));
ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 50, 0));
ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
ASSERT(1 == prepare_cb_called);
ASSERT(1 == check_cb_called);
ASSERT(1 == timer_cb_called);
ASSERT_OK(uv_prepare_init(uv_default_loop(), &prepare_handle));
ASSERT_OK(uv_check_init(uv_default_loop(), &check_handle));
ASSERT_OK(uv_check_start(&check_handle, check_cb));
ASSERT_OK(uv_timer_init(uv_default_loop(), &timer_handle));
ASSERT_OK(uv_timer_start(&timer_handle, timer_cb, 50, 0));
ASSERT_OK(uv_run(uv_default_loop(), UV_RUN_DEFAULT));
ASSERT_EQ(1, prepare_cb_called);
ASSERT_EQ(1, check_cb_called);
ASSERT_EQ(1, timer_cb_called);
uv_close((uv_handle_t*) &prepare_handle, NULL);
uv_close((uv_handle_t*) &check_handle, NULL);
uv_close((uv_handle_t*) &timer_handle, NULL);
ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_ONCE));
ASSERT_OK(uv_run(uv_default_loop(), UV_RUN_ONCE));
MAKE_VALGRIND_HAPPY(uv_default_loop());
return 0;
}