From 2b2c78d4f0a73498739cfc0879299d7325c35160 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Fri, 13 Nov 2015 11:22:21 +0000 Subject: Swap to using proper windows pipes We were using _pipe to create a pipe on windows. This uses the "int" type for its file descriptor for compatibility. However most windows functions expect to use a "HANDLE". Probably we could get away with just casting but it seems more robust to use the proper type and main stream windows functions. Reviewed-by: Rich Salz --- test/asynctest.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'test/asynctest.c') diff --git a/test/asynctest.c b/test/asynctest.c index d89e8ad789..5dd5c4adff 100644 --- a/test/asynctest.c +++ b/test/asynctest.c @@ -67,7 +67,7 @@ # if _POSIX_VERSION >= 200112L # define ASYNC_POSIX # endif -#elif (defined(_WIN32) || defined(__CYGWIN__)) && defined(_WINDLL) +#elif defined(_WIN32) || defined(__CYGWIN__) # define ASYNC_WIN #endif @@ -201,8 +201,9 @@ static int test_ASYNC_get_current_job() return 1; } -static int hasdata(int fd) +static int hasdata(OSSL_ASYNC_FD fd) { +#ifdef ASYNC_POSIX fd_set checkfds; struct timeval tv; FD_ZERO(&checkfds); @@ -213,12 +214,21 @@ static int hasdata(int fd) if (FD_ISSET(fd, &checkfds)) return 1; return 0; +#else + DWORD avail = 0; + + if (PeekNamedPipe(fd, NULL, 0, NULL, &avail, NULL) && avail > 0) + return 1; + + return 0; +#endif } static int test_ASYNC_get_wait_fd() { ASYNC_JOB *job = NULL; - int funcret, fd; + int funcret; + OSSL_ASYNC_FD fd; if ( !ASYNC_init_pool(1, 0) || ASYNC_start_job(&job, &funcret, wake, NULL, 0) -- cgit v1.2.3