|
Threads-Devel : |
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2007-11-19 17:57:32
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've finally found some time to start on the lock-order debugging code I
posted about here several months ago:
http://lists.boost.org/threads-devel/2007/07/0216.php
It's definitely not ready for prime-time yet, I'd say more like
demo/proof-of-concept stage. But I have gotten a trivial example program
running which commits a locking order violation, causing a graphviz file to
be dumped to stderr and then an abort.
I thought I'd share the code (it's only a couple kilobytes), in case anyone is
interested or has any feedback. Ther's also a png version of the example
program's graphviz output. The edges in the graph record locking order,
pointing towards the more recently locked mutex. The red arrow is the
locking event that created a cycle in the graph, violating locking order.
- --
Frank
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFHQhTo5vihyNWuA4URAhZRAJ93ClUbYLpyTssGjkY6nrb/AtGDtwCg61oD
1Cib1UsNWjW/69dxS87C2JE=
=ryeM
-----END PGP SIGNATURE-----
--Boundary-00=_oThQHVpp/322Iv+
Content-Type: application/x-tgz;
name="acyclic_mutex.tar.gz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="acyclic_mutex.tar.gz"
H4sIAHkNQkcAA+0aa2/bRtJfxV+xpxwEKpAoyvUDkGXjUsdNjTpxEOd6OQQBsSJXEmuKJMiVXZ3h
++03+yC5XFKWe016KG4HiCXtzszOe2bJYH/jR6HvrdaU/Dra+ybgAhwfH/JPAP2Tfx+7x/vugXt0
eHC85473D8YHe+jw24hTh3VOcYbQXpYk9Cm8Xft/UsA1/9d+Ocs0/SpnMAcfHR1s8f/44Oiw8v/Y
/Q78f3gMS8j9KqfvgP9z/49eWp1XiPsb3Wc4TUmG7pehv0R4TZMVpqGPo2iDaIb92xxFiX8bxguU
ZAEg0gSFcb7OCIoTFBAcsO3c6mBYSZM8D2cRcSyrMyOLMJ6gHzIc36IfSZ6j6Xy1hM+/rXOS5U6e
rDOfzJNsQZyY0DOE9qFiDMfucP/IejmyrNEIoddh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jkLeoU6SIIiurkzzrCF3Yzr2sOkUQiVlvbpQvp8Cwn4KugGGV4
SEu3KRd90Lw5Eq1SutHqnGiDrRZt0LPhwu4PzzQjF2OamNKali7ns2fEgXiavk3fdi76ZQ6mcY+t
1Z3JVuwa+0Hd9gM5lPRB+ywXUxokV1Vwm/Ni1QZ8zC6EIocaA12PZFmSKaW7cpfyLESGViF9caME
pKeugbVpouGxdJ0vPe62XjVWQ2iUAuiR0PY0zgfxpaNnbOAspmioKqywvAAvw8gKA+22NwTf6v3P
E+//PEpy6vi//yXg0+//XPf46Lh6/3c83nPHx+74O/P+74+A9tdJRfBqL4G6jffDXeVVTpgUL3ys
4vLHXuVA6VCppsXDB/ncIYwpWmF2o2XvfKotiYXtLu6ybGnszOzurH3Ht7s+33koH1+I9qf3WuAu
T+H5+CTqTKLOdqP6EtVnqI9fV4wa798gMYghr0AulJyqnNTz/y2+Jey16NeNsV35v79/WOY/+48f
7vjAPTgw+f9HgNUs+RN09frq8vub02HEa4Innla0Yp5/+vTD1as3gPsPHEVouEDDaxcN0+0klgV9
H8cwiv/V/vC2j5oo1jdrdgYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBg
wIABAwYM/MnhPxFqcjMAUAAA
--Boundary-00=_oThQHVpp/322Iv+
Content-Type: image/png;
name="mygraph.png"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="mygraph.png"
iVBORw0KGgoAAAANSUhEUgAAAIUAAAD7BAMAAAC23Eq+AAAAIVBMVEX+////AACfn58fHx+/v79f
X19/f38/Pz/f398AAAD///+H5HOjAAAAAXRSTlMAQObYZgAABC5JREFUeJzt279vEzEUB/D+C1k7
ghhgLQyZGSJlBKliRkKiOyDEjARipFTtZaJBhNh/JdBwTWy/H993fneXVFyX5HL3Odu5s99z3KNY
vX0/+m+MZYRKo2m3RUcjNA352mCERnoLGWXxiQrJBnXVUCCiQda+RCSD+z7z/YJRFrrdsvIJBkvk
H/EG3RibLS0ia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