2
This file is part of drd, a data race detector.
4
Copyright (C) 2006-2007 Bart Van Assche
5
bart.vanassche@gmail.com
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.
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.
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
22
The GNU General Public License is contained in the file COPYING.
30
// DRD vector clock implementation:
31
// - One counter per thread.
32
// - A vector clock is implemented as multiple pairs of (thread id, counter).
33
// - Pairs are stored in an array sorted by thread id.
35
// - Each time a thread performs an action that implies an ordering between
36
// intra-thread events, the counter of that thread is incremented.
37
// - Vector clocks are compared by comparing all counters of all threads.
38
// - When a thread synchronization action is performed that guarantees that
39
// new actions of the current thread are executed after the actions of the
40
// other thread, the vector clock of the synchronization object and the
41
// current thread are combined (by taking the component-wise maximum).
42
// - A vector clock is incremented during actions such as
43
// pthread_create(), pthread_mutex_unlock(), sem_post(). (Actions where
44
// an inter-thread ordering "arrow" starts).
47
#include "pub_tool_basics.h" // Addr, SizeT
64
void vc_init(VectorClock* const vc,
65
const VCElem* const vcelem,
67
void vc_cleanup(VectorClock* const vc);
68
void vc_copy(VectorClock* const new,
69
const VectorClock* const rhs);
70
void vc_increment(VectorClock* const vc, ThreadId const threadid);
71
Bool vc_lte(const VectorClock* const vc1,
72
const VectorClock* const vc2);
73
Bool vc_ordered(const VectorClock* const vc1,
74
const VectorClock* const vc2);
75
void vc_min(VectorClock* const result,
76
const VectorClock* const rhs);
77
void vc_combine(VectorClock* const result,
78
const VectorClock* const rhs);
79
void vc_print(const VectorClock* const vc);
80
void vc_snprint(Char* const str, Int const size,
81
const VectorClock* const vc);
82
void vc_check(const VectorClock* const vc);
86
#endif /* __DRD_VC_H */