1 /* 2 * Copyright 2007, Ingo Weinhold, bonefish@cs.tu-berlin.de. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #ifndef _KERNEL_WAIT_FOR_OBJECTS_H 7 #define _KERNEL_WAIT_FOR_OBJECTS_H 8 9 #include <OS.h> 10 11 #include <lock.h> 12 13 14 struct select_sync; 15 16 17 typedef struct select_info { 18 struct select_info* next; 19 struct select_sync* sync; 20 int32 events; 21 uint16 selected_events; 22 } select_info; 23 24 25 #define SELECT_FLAG(type) (1L << (type - 1)) 26 27 #define SELECT_OUTPUT_ONLY_FLAGS \ 28 (B_EVENT_ERROR | B_EVENT_DISCONNECTED | B_EVENT_INVALID) 29 30 #define SELECT_TYPE_IS_OUTPUT_ONLY(type) \ 31 ((SELECT_FLAG(type) & SELECT_OUTPUT_ONLY_FLAGS) != 0) 32 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 39 extern void acquire_select_sync(select_sync* sync); 40 extern void put_select_sync(select_sync* sync); 41 extern status_t notify_select_events(select_info* info, uint16 events); 42 extern void notify_select_events_list(select_info* list, uint16 events); 43 44 extern ssize_t _user_wait_for_objects(object_wait_info* userInfos, 45 int numInfos, uint32 flags, bigtime_t timeout); 46 47 48 #ifdef __cplusplus 49 } 50 #endif 51 52 #endif // _KERNEL_WAIT_FOR_OBJECTS_H 53