… | |
… | |
3978 | The normal C API should work fine when used from C++: both ev.h and the |
3978 | The normal C API should work fine when used from C++: both ev.h and the |
3979 | libev sources can be compiled as C++. Therefore, code that uses the C API |
3979 | libev sources can be compiled as C++. Therefore, code that uses the C API |
3980 | will work fine. |
3980 | will work fine. |
3981 | |
3981 | |
3982 | Proper exception specifications might have to be added to callbacks passed |
3982 | Proper exception specifications might have to be added to callbacks passed |
3983 | to libev: exceptions may be thrown only from watcher callbacks, all |
3983 | to libev: exceptions may be thrown only from watcher callbacks, all other |
3984 | other callbacks (allocator, syserr, loop acquire/release and periodic |
3984 | callbacks (allocator, syserr, loop acquire/release and periodic reschedule |
3985 | reschedule callbacks) must not throw exceptions, and might need a C<throw |
3985 | callbacks) must not throw exceptions, and might need a C<noexcept> |
3986 | ()> specification. If you have code that needs to be compiled as both C |
3986 | specification. If you have code that needs to be compiled as both C and |
3987 | and C++ you can use the C<EV_THROW> macro for this: |
3987 | C++ you can use the C<EV_NOEXCEPT> macro for this: |
3988 | |
3988 | |
3989 | static void |
3989 | static void |
3990 | fatal_error (const char *msg) EV_THROW |
3990 | fatal_error (const char *msg) EV_NOEXCEPT |
3991 | { |
3991 | { |
3992 | perror (msg); |
3992 | perror (msg); |
3993 | abort (); |
3993 | abort (); |
3994 | } |
3994 | } |
3995 | |
3995 | |