… | |
… | |
983 | In general you can register as many read and/or write event watchers per |
983 | In general you can register as many read and/or write event watchers per |
984 | fd as you want (as long as you don't confuse yourself). Setting all file |
984 | fd as you want (as long as you don't confuse yourself). Setting all file |
985 | descriptors to non-blocking mode is also usually a good idea (but not |
985 | descriptors to non-blocking mode is also usually a good idea (but not |
986 | required if you know what you are doing). |
986 | required if you know what you are doing). |
987 | |
987 | |
988 | You have to be careful with dup'ed file descriptors, though. Some backends |
|
|
989 | (the linux epoll backend is a notable example) cannot handle dup'ed file |
|
|
990 | descriptors correctly if you register interest in two or more fds pointing |
|
|
991 | to the same underlying file/socket/etc. description (that is, they share |
|
|
992 | the same underlying "file open"). |
|
|
993 | |
|
|
994 | If you must do this, then force the use of a known-to-be-good backend |
988 | If you must do this, then force the use of a known-to-be-good backend |
995 | (at the time of this writing, this includes only C<EVBACKEND_SELECT> and |
989 | (at the time of this writing, this includes only C<EVBACKEND_SELECT> and |
996 | C<EVBACKEND_POLL>). |
990 | C<EVBACKEND_POLL>). |
997 | |
991 | |
998 | Another thing you have to watch out for is that it is quite easy to |
992 | Another thing you have to watch out for is that it is quite easy to |
… | |
… | |
1033 | |
1027 | |
1034 | =head3 The special problem of dup'ed file descriptors |
1028 | =head3 The special problem of dup'ed file descriptors |
1035 | |
1029 | |
1036 | Some backends (e.g. epoll), cannot register events for file descriptors, |
1030 | Some backends (e.g. epoll), cannot register events for file descriptors, |
1037 | but only events for the underlying file descriptions. That means when you |
1031 | but only events for the underlying file descriptions. That means when you |
1038 | have C<dup ()>'ed file descriptors and register events for them, only one |
1032 | have C<dup ()>'ed file descriptors or weirder constellations, and register |
1039 | file descriptor might actually receive events. |
1033 | events for them, only one file descriptor might actually receive events. |
1040 | |
1034 | |
1041 | There is no workaround possible except not registering events |
1035 | There is no workaround possible except not registering events |
1042 | for potentially C<dup ()>'ed file descriptors, or to resort to |
1036 | for potentially C<dup ()>'ed file descriptors, or to resort to |
1043 | C<EVBACKEND_SELECT> or C<EVBACKEND_POLL>. |
1037 | C<EVBACKEND_SELECT> or C<EVBACKEND_POLL>. |
1044 | |
1038 | |
… | |
… | |
2501 | be detected at runtime. |
2495 | be detected at runtime. |
2502 | |
2496 | |
2503 | =item EV_H |
2497 | =item EV_H |
2504 | |
2498 | |
2505 | The name of the F<ev.h> header file used to include it. The default if |
2499 | The name of the F<ev.h> header file used to include it. The default if |
2506 | undefined is C<< <ev.h> >> in F<event.h> and C<"ev.h"> in F<ev.c>. This |
2500 | undefined is C<"ev.h"> in F<event.h> and F<ev.c>. This can be used to |
2507 | can be used to virtually rename the F<ev.h> header file in case of conflicts. |
2501 | virtually rename the F<ev.h> header file in case of conflicts. |
2508 | |
2502 | |
2509 | =item EV_CONFIG_H |
2503 | =item EV_CONFIG_H |
2510 | |
2504 | |
2511 | If C<EV_STANDALONE> isn't C<1>, this variable can be used to override |
2505 | If C<EV_STANDALONE> isn't C<1>, this variable can be used to override |
2512 | F<ev.c>'s idea of where to find the F<config.h> file, similarly to |
2506 | F<ev.c>'s idea of where to find the F<config.h> file, similarly to |
2513 | C<EV_H>, above. |
2507 | C<EV_H>, above. |
2514 | |
2508 | |
2515 | =item EV_EVENT_H |
2509 | =item EV_EVENT_H |
2516 | |
2510 | |
2517 | Similarly to C<EV_H>, this macro can be used to override F<event.c>'s idea |
2511 | Similarly to C<EV_H>, this macro can be used to override F<event.c>'s idea |
2518 | of how the F<event.h> header can be found. |
2512 | of how the F<event.h> header can be found, the dfeault is C<"event.h">. |
2519 | |
2513 | |
2520 | =item EV_PROTOTYPES |
2514 | =item EV_PROTOTYPES |
2521 | |
2515 | |
2522 | If defined to be C<0>, then F<ev.h> will not define any function |
2516 | If defined to be C<0>, then F<ev.h> will not define any function |
2523 | prototypes, but still define all the structs and other symbols. This is |
2517 | prototypes, but still define all the structs and other symbols. This is |