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(0 == uv_loop_init(&loop)); |
28 | #ifdef _WIN32 |
29 | ASSERT(UV_ENOSYS == uv_loop_configure(&loop, UV_LOOP_BLOCK_SIGNAL, 0)); |
30 | #else |
31 | ASSERT(0 == uv_loop_configure(&loop, UV_LOOP_BLOCK_SIGNAL, SIGPROF)); |
32 | #endif |
33 | ASSERT(0 == uv_timer_init(&loop, &timer_handle)); |
34 | ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 10, 0)); |
35 | ASSERT(0 == uv_run(&loop, UV_RUN_DEFAULT)); |
36 | ASSERT(0 == uv_loop_close(&loop)); |
37 | return 0; |
38 | } |
39 | |