All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
async_read.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Takuo Yonezawa <Yonezawa-T2@mail.dnp.co.jp>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for
6  * more details.
7  */
8 
19 #ifndef ASYNC_READ_H
20 #define ASYNC_READ_H
21 
22 #include <sys/types.h>
23 #include <poll.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
32 #ifndef ASYNC_READ_NUMOF
33 # define ASYNC_READ_NUMOF 8
34 #endif
35 
39 typedef void (*native_async_read_callback_t)(int fd, void *arg);
40 
44 typedef struct {
45  pid_t child_pid;
47  void *arg;
48  struct pollfd *fd;
49 } async_read_t;
50 
57 
64 
73 
83 
90 
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #endif /* ASYNC_READ_H */
void native_async_read_add_handler(int fd, void *arg, native_async_read_callback_t handler)
start monitoring of file descriptor
void native_async_read_cleanup(void)
shutdown asynchronous read system
void native_async_read_add_int_handler(int fd, void *arg, native_async_read_callback_t handler)
start monitoring of file descriptor as interrupt
void native_async_read_remove_handler(int fd)
stop monitoring of file descriptor
void(* native_async_read_callback_t)(int fd, void *arg)
asynchronous read callback type
Definition: async_read.h:39
void native_async_read_setup(void)
initialize asynchronous read system
void native_async_read_continue(int fd)
resume monitoring of file descriptors
Interrupt callback information structure.
Definition: async_read.h:44
void * arg
Argument ptr for the callback.
Definition: async_read.h:47
pid_t child_pid
PID of the interrupt listener.
Definition: async_read.h:45
native_async_read_callback_t cb
Interrupt callback function.
Definition: async_read.h:46
struct pollfd * fd
sysfs gpio fd
Definition: async_read.h:48