1 // SPDX-License-Identifier: GPL-2.0
3 // waiter.h - a header for I/O event waiter.
5 // Copyright (c) 2018 Takashi Sakamoto <o-takashi@sakamocchi.jp>
7 // Licensed under the terms of the GNU General Public License, version 2.
9 #ifndef __ALSA_UTILS_AXFER_WAITER__H_
10 #define __ALSA_UTILS_AXFER_WAITER__H_
15 WAITER_TYPE_DEFAULT = 0,
24 struct waiter_context {
25 enum waiter_type type;
26 const struct waiter_ops *ops;
30 unsigned int pfd_count;
33 enum waiter_type waiter_type_from_label(const char *label);
34 const char *waiter_label_from_type(enum waiter_type type);
36 int waiter_context_init(struct waiter_context *waiter,
37 enum waiter_type type, unsigned int pfd_count);
38 int waiter_context_prepare(struct waiter_context *waiter);
39 int waiter_context_wait_event(struct waiter_context *waiter,
41 void waiter_context_release(struct waiter_context *waiter);
42 void waiter_context_destroy(struct waiter_context *waiter);
44 // For internal use in 'waiter' module.
47 int (*prepare)(struct waiter_context *waiter);
48 int (*wait_event)(struct waiter_context *waiter, int timeout_msec);
49 void (*release)(struct waiter_context *waiter);
53 struct waiter_ops ops;
54 unsigned int private_size;
57 extern const struct waiter_data waiter_poll;
58 extern const struct waiter_data waiter_select;
59 extern const struct waiter_data waiter_epoll;