ach
Real-Time IPC Library
experimental.h
Go to the documentation of this file.
1 /* -*- mode: C; c-basic-offset: 4 -*- */
2 /* ex: set shiftwidth=4 tabstop=4 expandtab: */
3 /*
4  * Copyright (c) 2014, Georgia Tech Research Corporation
5  * Copyright (C) 2015, Rice University
6  * All rights reserved.
7  *
8  * Author(s): Neil T. Dantam <ntd@rice.edu>
9  * Georgia Tech Humanoid Robotics Lab
10  * Under Direction of Prof. Mike Stilman <mstilman@cc.gatech.edu>
11  *
12  *
13  * This file is provided under the following "BSD-style" License:
14  *
15  *
16  * Redistribution and use in source and binary forms, with or
17  * without modification, are permitted provided that the following
18  * conditions are met:
19  *
20  * * Redistributions of source code must retain the above copyright
21  * notice, this list of conditions and the following disclaimer.
22  *
23  * * Redistributions in binary form must reproduce the above
24  * copyright notice, this list of conditions and the following
25  * disclaimer in the documentation and/or other materials provided
26  * with the distribution.
27  *
28  * * Neither the name of the copyright holder the names of its
29  * contributors may be used to endorse or promote products derived
30  * from this software without specific prior written permission.
31  *
32  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
33  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
34  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
35  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
36  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
37  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
38  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
39  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
40  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
41  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
42  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
43  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44  * POSSIBILITY OF SUCH DAMAGE.
45  *
46  */
47 
57 #ifndef ACH_EXPERIMENTAL_H
58 #define ACH_EXPERIMENTAL_H
59 
60 
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
68 struct ach_evhandler {
72 
75  void *context;
76 
85  enum ach_status (*handler)
86  ( void *context, struct ach_channel *channel );
87 };
88 
89 /* Options for event handler */
90 
93 #define ACH_EV_O_PERIODIC_TIMEOUT 0x01
94 
97 #define ACH_EV_O_PERIODIC_INPUT 0x02
98 
99 
120 ach_evhandle( struct ach_evhandler *handlers,
121  size_t n,
122  const struct timespec *period,
123  enum ach_status (*periodic_handler)(void *context),
124  void *periodic_context,
125  int options );
126 
127 #ifdef __cplusplus
128 }
129 #endif
130 
131 #endif /* ACH_H */
enum ach_status ACH_WARN_UNUSED ach_evhandle(struct ach_evhandler *handlers, size_t n, const struct timespec *period, enum ach_status(*periodic_handler)(void *context), void *periodic_context, int options)
Event loop for handling multiple channels.
Control structure for event handling loop.
Definition: experimental.h:68
void * context
Context argument for handler.
Definition: experimental.h:75
enum ach_status(* handler)(void *context, struct ach_channel *channel)
Handler function.
Definition: experimental.h:86
#define ACH_WARN_UNUSED
Warn if result is unused.
Definition: generic.h:73
Descriptor for an Ach channel.
Definition: ach.h:335
struct ach_channel * channel
Channel to get messages from.
Definition: experimental.h:71
ach_status
return status codes for ach functions.
Definition: generic.h:84