5 std::mutex t1_mutex
, t2_mutex
;
17 void t_func(std::mutex
&t_mutex
, const test_data
&t_data
) {
18 std::lock_guard
<std::mutex
> t_lock(t_mutex
);
25 : "a"(t_data
.eax
), "b"(t_data
.ebx
), "m"(t_data
.st0
)
34 .st0
= {0x8070605040302010, 0x4000},
39 .st0
= {0x8171615141312111, 0xc000},
42 // block both threads from proceeding
43 std::unique_lock
<std::mutex
> m1_lock(t1_mutex
);
44 std::unique_lock
<std::mutex
> m2_lock(t2_mutex
);
47 std::thread
t1(t_func
, std::ref(t1_mutex
), std::ref(t1_data
));
48 std::thread
t2(t_func
, std::ref(t2_mutex
), std::ref(t2_data
));
50 // release lock on thread 1 to make it interrupt the program
52 // wait for thread 1 to finish
55 // release lock on thread 2
57 // wait for thread 2 to finish