File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 36
36
#include <sys/poll.h>
37
37
#endif
38
38
39
+ /* convert microseconds to milliseconds (round up) */
40
+ #define USEC_TO_MSEC (t ) ((t) > 0 ? ((t) + 999) / 1000 : (t))
41
+
39
42
apr_status_t apr_wait_for_io_or_timeout (apr_file_t * f , apr_socket_t * s ,
40
43
int for_read )
41
44
{
42
45
struct pollfd pfd ;
43
46
int rc , timeout ;
44
47
45
- timeout = f ? f -> timeout : s -> timeout ;
46
- pfd .fd = f ? f -> filedes : s -> socketdes ;
47
- pfd .events = for_read ? POLLIN : POLLOUT ;
48
+ timeout = f ? USEC_TO_MSEC ( f -> timeout ) : USEC_TO_MSEC ( s -> timeout ) ;
49
+ pfd .fd = f ? f -> filedes : s -> socketdes ;
50
+ pfd .events = for_read ? POLLIN : POLLOUT ;
48
51
49
- if (timeout > 0 ) {
50
- timeout = (timeout + 999 ) / 1000 ;
51
- }
52
52
do {
53
53
rc = poll (& pfd , 1 , timeout );
54
54
} while (rc == -1 && errno == EINTR );
You can’t perform that action at this time.
0 commit comments