1 | /* |
1 | /* |
|
|
2 | * libev event processing core, watcher management |
|
|
3 | * |
2 | * Copyright (c) 2007 Marc Alexander Lehmann <libev@schmorp.de> |
4 | * Copyright (c) 2007 Marc Alexander Lehmann <libev@schmorp.de> |
3 | * All rights reserved. |
5 | * All rights reserved. |
4 | * |
6 | * |
5 | * Redistribution and use in source and binary forms, with or without |
7 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are |
8 | * modification, are permitted provided that the following conditions are |
… | |
… | |
45 | #include <sys/wait.h> |
47 | #include <sys/wait.h> |
46 | #include <sys/time.h> |
48 | #include <sys/time.h> |
47 | #include <time.h> |
49 | #include <time.h> |
48 | |
50 | |
49 | #ifndef EV_USE_MONOTONIC |
51 | #ifndef EV_USE_MONOTONIC |
50 | # ifdef CLOCK_MONOTONIC |
|
|
51 | # define EV_USE_MONOTONIC 1 |
52 | # define EV_USE_MONOTONIC 1 |
52 | # endif |
53 | #endif |
|
|
54 | |
|
|
55 | #ifndef CLOCK_MONOTONIC |
|
|
56 | # undef EV_USE_MONOTONIC |
|
|
57 | # define EV_USE_MONOTONIC 0 |
53 | #endif |
58 | #endif |
54 | |
59 | |
55 | #ifndef EV_USE_SELECT |
60 | #ifndef EV_USE_SELECT |
56 | # define EV_USE_SELECT 1 |
61 | # define EV_USE_SELECT 1 |
57 | #endif |
62 | #endif |
… | |
… | |
761 | /*****************************************************************************/ |
766 | /*****************************************************************************/ |
762 | |
767 | |
763 | void |
768 | void |
764 | ev_io_start (struct ev_io *w) |
769 | ev_io_start (struct ev_io *w) |
765 | { |
770 | { |
766 | if (ev_is_active (w)) |
|
|
767 | return; |
|
|
768 | |
|
|
769 | int fd = w->fd; |
771 | int fd = w->fd; |
|
|
772 | |
|
|
773 | if (ev_is_active (w)) |
|
|
774 | return; |
770 | |
775 | |
771 | assert (("ev_io_start called with negative fd", fd >= 0)); |
776 | assert (("ev_io_start called with negative fd", fd >= 0)); |
772 | |
777 | |
773 | ev_start ((W)w, 1); |
778 | ev_start ((W)w, 1); |
774 | array_needsize (anfds, anfdmax, fd + 1, anfds_init); |
779 | array_needsize (anfds, anfdmax, fd + 1, anfds_init); |