blob: 2a3b94570b98b392a01c8ae7155cf0b50c47c15a [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// Condition variable state information: mutex specified in pthread_cond_wait()
27// call.
28
29
30#ifndef __COND_H
31#define __COND_H
32
33
34#include "pub_tool_basics.h" // Addr, SizeT
35#include "drd_vc.h"
36#include "drd_thread.h" // DrdThreadId
37
38
39struct cond_info
40{
41 Addr cond; // Pointer to client condition variable.
42 int waiter_count;
43 Addr mutex; // Client mutex specified in pthread_cond_wait() call, and null
44 // if no client threads are currently waiting on this cond.var.
45};
46
47void cond_set_trace(const Bool trace_cond);
48void cond_init(const Addr cond);
49void cond_destroy(struct cond_info* const p);
50struct cond_info* cond_get(Addr const mutex);
51int cond_pre_wait(const Addr cond, const Addr mutex);
52int cond_post_wait(const Addr cond);
53void cond_pre_signal(Addr const cond);
54void cond_pre_broadcast(Addr const cond);
55void cond_stop_using_mem(const Addr a1, const Addr a2);
56
57
58#endif /* __COND_H */