blob: 03d2994b03ccb8f35308d7520d72389034eb01e3 [file] [log] [blame]
sewardjaf44c822007-11-25 14:01:38 +00001/*
2 This file is part of drd, a data race detector.
3
4 Copyright (C) 2006-2007 Bart Van Assche
5 bart.vanassche@gmail.com
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 02111-1307, USA.
21
22 The GNU General Public License is contained in the file COPYING.
23*/
24
25
26// Mutex state information: owner thread and recursion count.
27
28
29#ifndef __MUTEX_H
30#define __MUTEX_H
31
32
33#include "pub_tool_basics.h" // Addr, SizeT
34#include "drd_vc.h"
35#include "drd_thread.h" // DrdThreadId
36
37
38struct mutex_info;
39
40
41void mutex_set_trace(const Bool trace_mutex);
42struct mutex_info* mutex_init(const Addr mutex, const SizeT size);
43void mutex_destroy(struct mutex_info* const p);
44struct mutex_info* mutex_get(const Addr mutex);
45int mutex_lock(const Addr mutex, const SizeT size);
46int mutex_unlock(const Addr mutex);
47const char* mutex_get_typename(struct mutex_info* const p);
48Bool mutex_is_locked_by(const Addr mutex, const DrdThreadId tid);
49const VectorClock* mutex_get_last_vc(const Addr mutex);
50int mutex_get_recursion_count(const Addr mutex);
51void mutex_thread_delete(const DrdThreadId threadid);
52void mutex_stop_using_mem(const Addr a1, const Addr a2);
53ULong get_mutex_lock_count(void);
54
55
56#endif /* __MUTEX_H */