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; // next in the object's list 19 struct select_sync* sync; 20 int32 events; 21 uint16 selected_events; 22 } select_info; 23 24 typedef struct select_sync { 25 int32 ref_count; 26 sem_id sem; 27 uint32 count; 28 struct select_info* set; 29 } select_sync; 30 31 #define SELECT_FLAG(type) (1L << (type - 1)) 32 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 39 extern void put_select_sync(select_sync* sync); 40 extern status_t notify_select_events(select_info* info, uint16 events); 41 extern void notify_select_events_list(select_info* list, uint16 events); 42 43 extern ssize_t _user_wait_for_objects(object_wait_info* userInfos, 44 int numInfos, uint32 flags, bigtime_t timeout); 45 46 47 #ifdef __cplusplus 48 } 49 #endif 50 51 #endif // _KERNEL_WAIT_FOR_OBJECTS_H 52