// -*- Mode: CFA -*- // // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo // // The contents of this file are covered under the licence agreement in the // file "LICENCE" distributed with Cforall. // // monitor -- // // Author : Thierry Delisle // Created On : Thd Feb 23 12:27:26 2017 // Last Modified By : Thierry Delisle // Last Modified On : -- // Update Count : 0 // #ifndef MONITOR_H #define MONITOR_H #include #include "assert" #include "invoke.h" #include "stdlib" static inline void ?{}(monitor_desc * this) { this->owner = NULL; this->recursion = 0; } struct monitor_guard_t { monitor_desc ** m; int count; monitor_desc ** prev_mntrs; unsigned short prev_count; }; static inline int ?monitors = NULL; this->monitor_count = 0; } static inline void ^?{}( condition * this ) { free( this->monitors ); } void wait( condition * this, uintptr_t user_info = 0 ); bool signal( condition * this ); bool signal_block( condition * this ); static inline bool is_empty( condition * this ) { return !this->blocked.head; } uintptr_t front( condition * this ); struct __acceptable_t { void (*func)(void); unsigned short count; monitor_desc * monitors[1]; }; void __accept_internal( unsigned short count, __acceptable_t * acceptables, void (*func)(void) ); #endif //MONITOR_H