Boost logo

Boost Users :

Subject: Re: [Boost-users] [Asio] Need help making a custom service
From: Bjorn Reese (breese_at_[hidden])
Date: 2015-03-09 16:21:56


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.html
[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_socket.hpp


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net