1/** 2 * \file 3 * \brief Event mutex 4 */ 5 6/* 7 * Copyright (c) 2010, ETH Zurich. 8 * All rights reserved. 9 * 10 * This file is distributed under the terms in the attached LICENSE file. 11 * If you do not find this file, copies can be found by writing to: 12 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group. 13 */ 14 15#ifndef BARRELFISH_EVENT_MUTEX_H 16#define BARRELFISH_EVENT_MUTEX_H 17 18#include <sys/cdefs.h> 19 20#include <barrelfish/event_queue.h> 21#include <barrelfish/threads.h> 22 23__BEGIN_DECLS 24 25struct event_mutex { 26 struct thread_mutex tmutex; 27 struct event_queue equeue; 28 struct thread *tqueue; 29 bool locked; 30}; 31 32void event_mutex_init(struct event_mutex *em, struct waitset *waitset); 33bool event_mutex_enqueue_lock(struct event_mutex *em, 34 struct event_queue_node *qn, 35 struct event_closure lockcont); 36void event_mutex_threaded_lock(struct event_mutex *em); 37void event_mutex_unlock(struct event_mutex *em); 38 39__END_DECLS 40 41#endif // BARRELFISH_EVENT_MUTEX_H 42