1 1.1 christos /* Copyright (c) 2014, Ben Noordhuis <info (at) bnoordhuis.nl> 2 1.1 christos * 3 1.1 christos * Permission to use, copy, modify, and/or distribute this software for any 4 1.1 christos * purpose with or without fee is hereby granted, provided that the above 5 1.1 christos * copyright notice and this permission notice appear in all copies. 6 1.1 christos * 7 1.1 christos * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 1.1 christos * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 1.1 christos * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 1.1 christos * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 1.1 christos * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 1.1 christos * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 1.1 christos * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 1.1 christos */ 15 1.1 christos 16 1.1 christos #include "uv.h" 17 1.1 christos #include "task.h" 18 1.1 christos 19 1.1 christos static void timer_cb(uv_timer_t* handle) { 20 1.1 christos uv_close((uv_handle_t*) handle, NULL); 21 1.1 christos } 22 1.1 christos 23 1.1 christos 24 1.1 christos TEST_IMPL(loop_configure) { 25 1.1 christos uv_timer_t timer_handle; 26 1.1 christos uv_loop_t loop; 27 1.1.1.2 christos ASSERT_OK(uv_loop_init(&loop)); 28 1.1 christos #ifdef _WIN32 29 1.1.1.2 christos ASSERT_EQ(UV_ENOSYS, uv_loop_configure(&loop, UV_LOOP_BLOCK_SIGNAL, 0)); 30 1.1 christos #else 31 1.1.1.2 christos ASSERT_OK(uv_loop_configure(&loop, UV_LOOP_BLOCK_SIGNAL, SIGPROF)); 32 1.1 christos #endif 33 1.1.1.2 christos ASSERT_OK(uv_timer_init(&loop, &timer_handle)); 34 1.1.1.2 christos ASSERT_OK(uv_timer_start(&timer_handle, timer_cb, 10, 0)); 35 1.1.1.2 christos ASSERT_OK(uv_run(&loop, UV_RUN_DEFAULT)); 36 1.1.1.2 christos ASSERT_OK(uv_loop_close(&loop)); 37 1.1 christos return 0; 38 1.1 christos } 39