1
2Establish order 1 -> 2
3Try order 2 -> 1.  This gives an error.
4---Thread-Announcement------------------------------------------
5
6Thread #x is the program's root thread
7
8----------------------------------------------------------------
9
10Thread #x: lock order "0x........ before 0x........" violated
11
12Observed (incorrect) order is: acquisition of lock at 0x........
13   at 0x........: mutex_lock_WRK (hg_intercepts.c:...)
14   by 0x........: pthread_mutex_lock (hg_intercepts.c:...)
15   by 0x........: main (tc15_laog_lockdel.c:35)
16
17 followed by a later acquisition of lock at 0x........
18   at 0x........: mutex_lock_WRK (hg_intercepts.c:...)
19   by 0x........: pthread_mutex_lock (hg_intercepts.c:...)
20   by 0x........: main (tc15_laog_lockdel.c:36)
21
22Required order was established by acquisition of lock at 0x........
23   at 0x........: mutex_lock_WRK (hg_intercepts.c:...)
24   by 0x........: pthread_mutex_lock (hg_intercepts.c:...)
25   by 0x........: main (tc15_laog_lockdel.c:27)
26
27 followed by a later acquisition of lock at 0x........
28   at 0x........: mutex_lock_WRK (hg_intercepts.c:...)
29   by 0x........: pthread_mutex_lock (hg_intercepts.c:...)
30   by 0x........: main (tc15_laog_lockdel.c:28)
31
32 Lock at 0x........ was first observed
33   at 0x........: pthread_mutex_init (hg_intercepts.c:...)
34   by 0x........: main (tc15_laog_lockdel.c:22)
35 Address 0x........ is 0 bytes inside a block of size 120 alloc'd
36   at 0x........: malloc (vg_replace_malloc.c:...)
37   by 0x........: main (tc15_laog_lockdel.c:16)
38 Block was alloc'd by thread #x
39
40 Lock at 0x........ was first observed
41   at 0x........: pthread_mutex_init (hg_intercepts.c:...)
42   by 0x........: main (tc15_laog_lockdel.c:23)
43 Address 0x........ is 0 bytes inside a block of size 120 alloc'd
44   at 0x........: malloc (vg_replace_malloc.c:...)
45   by 0x........: main (tc15_laog_lockdel.c:17)
46 Block was alloc'd by thread #x
47
48
49Free 2 and re-allocate it.  This gives it a new identity,
50so a second locking sequence 2 -> 1 should now be OK.
51done
52
53ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
54