On 03/09/2015 06:49 PM, Kyle Edwards wrote:
Second, I have a question about making a custom service. I would like to make a service that triggers a callback when a GPIO pin changes state and triggers an interrupt (I'm using a Raspberry Pi.) I have (or can obtain) a file descriptor that can be poll()'d, select()'d, or epoll'd and which omits high-priority events (POLLPRI, EPOLLPRI, etc.). This
Then you can wrap your file descriptor in a posix::stream_descriptor [1] and wait on events using async_read_some() with null_buffers() [2]. An example can be found in [3]. The example assumes that the wrapper does not take ownership of the file descriptor (if it does, then you can omit the non_closing_service.) [1] http://www.boost.org/doc/html/boost_asio/overview/posix/stream_descriptor.ht... [2] http://www.boost.org/doc/html/boost_asio/overview/core/reactor.html [3] https://github.com/breese/aware/blob/master/include/aware/detail/native_sock...