36 #ifndef R_EXT_EVENTLOOP_H
37 #define R_EXT_EVENTLOOP_H
40 #ifdef HAVE_SYS_SELECT_H
41 # include <sys/select.h>
44 # include <sys/types.h>
52 #define StdinActivity 2
54 typedef void (*InputHandlerProc)(
void *userData);
56 typedef struct _InputHandler {
60 InputHandlerProc handler;
62 struct _InputHandler *next;
76 extern InputHandler *initStdinHandler(
void);
77 extern void consoleInputHandler(
unsigned char *buf,
int len);
79 extern InputHandler *addInputHandler(InputHandler *handlers,
int fd, InputHandlerProc handler,
int activity);
80 extern InputHandler *getInputHandler(InputHandler *handlers,
int fd);
81 extern int removeInputHandler(InputHandler **handlers, InputHandler *it);
82 extern InputHandler *getSelectedHandler(InputHandler *handlers, fd_set *mask);
83 extern fd_set *R_checkActivity(
int usec,
int ignore_stdin);
84 extern fd_set *R_checkActivityEx(
int usec,
int ignore_stdin,
void (*intr)(
void));
85 extern void R_runHandlers(InputHandler *handlers, fd_set *mask);
87 extern int R_SelectEx(
int n, fd_set *readfds, fd_set *writefds,
88 fd_set *exceptfds,
struct timeval *timeout,
93 InputHandler *R_InputHandlers;
96 extern InputHandler *R_InputHandlers;
99 extern void (* R_PolledEvents)(void);
100 extern int R_wait_usec;