~bkerensa/ubuntu/raring/valgrind/merge-from-deb

« back to all changes in this revision

Viewing changes to exp-drd/drd_cond.h

  • Committer: Bazaar Package Importer
  • Author(s): Andrés Roldán
  • Date: 2008-06-13 02:31:40 UTC
  • mto: (1.4.1 upstream) (2.2.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: james.westby@ubuntu.com-20080613023140-iwk33rz9rhvfkr96
Import upstream version 3.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
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
 
 
39
struct cond_info
 
40
{
 
41
  Addr  cond;  // Pointer to client condition variable.
 
42
  SizeT size;  // sizeof(pthread_cond_t)
 
43
  int   waiter_count;
 
44
  Addr  mutex; // Client mutex specified in pthread_cond_wait() call, and null
 
45
              // if no client threads are currently waiting on this cond.var.
 
46
};
 
47
 
 
48
void cond_set_trace(const Bool trace_cond);
 
49
void cond_init(const Addr cond, const SizeT size);
 
50
void cond_destroy(struct cond_info* const p);
 
51
struct cond_info* cond_get(Addr const mutex);
 
52
int cond_pre_wait(const Addr cond, const SizeT cond_size, const Addr mutex);
 
53
int cond_post_wait(const Addr cond);
 
54
void cond_pre_signal(Addr const cond);
 
55
void cond_pre_broadcast(Addr const cond);
 
56
void cond_stop_using_mem(const Addr a1, const Addr a2);
 
57
 
 
58
 
 
59
#endif /* __COND_H */