async_read.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2015 Takuo Yonezawa <Yonezawa-T2@mail.dnp.co.jp>
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
19 #include <sys/types.h>
20 #include <poll.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
29 #ifndef ASYNC_READ_NUMOF
30 # define ASYNC_READ_NUMOF 8
31 #endif
32 
36 typedef void (*native_async_read_callback_t)(int fd, void *arg);
37 
41 typedef struct {
42  pid_t child_pid;
44  void *arg;
45  struct pollfd *fd;
46 } async_read_t;
47 
54 
61 
70 
80 
87 
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
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:36
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:41
void * arg
Argument ptr for the callback.
Definition: async_read.h:44
pid_t child_pid
PID of the interrupt listener.
Definition: async_read.h:42
native_async_read_callback_t cb
Interrupt callback function.
Definition: async_read.h:43
struct pollfd * fd
sysfs gpio fd
Definition: async_read.h:45