// -*- 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 "assert" #include "invoke.h" struct monitor { spinlock lock; thread * holder; simple_thread_list entry_queue; }; void enter(monitor *); void leave(monitor *); struct monitor_guard { monitor * m; }; static inline void ?{}( monitor_guard * this, monitor * m ) { this->m = m; enter( this->m ); } static inline void ^?{}( monitor_guard * this ) { leave( this->m ); } #endif //MONITOR_H