Mercurial
comparison third_party/libuv/test/test-loop-configure.c @ 160:948de3f54cea
[ThirdParty] Added libuv
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Wed, 14 Jan 2026 19:39:52 -0800 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 159:05cf9467a1c3 | 160:948de3f54cea |
|---|---|
| 1 /* Copyright (c) 2014, Ben Noordhuis <[email protected]> | |
| 2 * | |
| 3 * Permission to use, copy, modify, and/or distribute this software for any | |
| 4 * purpose with or without fee is hereby granted, provided that the above | |
| 5 * copyright notice and this permission notice appear in all copies. | |
| 6 * | |
| 7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
| 10 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
| 12 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
| 13 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 14 */ | |
| 15 | |
| 16 #include "uv.h" | |
| 17 #include "task.h" | |
| 18 | |
| 19 static void timer_cb(uv_timer_t* handle) { | |
| 20 uv_close((uv_handle_t*) handle, NULL); | |
| 21 } | |
| 22 | |
| 23 | |
| 24 TEST_IMPL(loop_configure) { | |
| 25 uv_timer_t timer_handle; | |
| 26 uv_loop_t loop; | |
| 27 ASSERT_OK(uv_loop_init(&loop)); | |
| 28 #ifdef _WIN32 | |
| 29 ASSERT_EQ(UV_ENOSYS, uv_loop_configure(&loop, UV_LOOP_BLOCK_SIGNAL, 0)); | |
| 30 #else | |
| 31 ASSERT_OK(uv_loop_configure(&loop, UV_LOOP_BLOCK_SIGNAL, SIGPROF)); | |
| 32 #endif | |
| 33 ASSERT_OK(uv_timer_init(&loop, &timer_handle)); | |
| 34 ASSERT_OK(uv_timer_start(&timer_handle, timer_cb, 10, 0)); | |
| 35 ASSERT_OK(uv_run(&loop, UV_RUN_DEFAULT)); | |
| 36 ASSERT_OK(uv_loop_close(&loop)); | |
| 37 return 0; | |
| 38 } |