From: Dmitriy Vyukov Date: Wed, 31 Jul 2013 18:03:59 +0000 (+0400) Subject: runtime: better debug output for inconsistent Note X-Git-Tag: go1.2rc2~865 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=98d94b589cfb03104c0bfd7d4e89b23b1d3ddf73;p=gostls13.git runtime: better debug output for inconsistent Note Update #5139. Double wakeup on Note was reported several times, but no reliable reproducer. There also was a strange report about weird value of epoll fd. Maybe it's corruption of global data... R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/12182043 --- diff --git a/src/pkg/runtime/lock_futex.c b/src/pkg/runtime/lock_futex.c index 3f8d632363..bb40b92559 100644 --- a/src/pkg/runtime/lock_futex.c +++ b/src/pkg/runtime/lock_futex.c @@ -118,8 +118,13 @@ runtime·noteclear(Note *n) void runtime·notewakeup(Note *n) { - if(runtime·xchg((uint32*)&n->key, 1)) + uint32 old; + + old = runtime·xchg((uint32*)&n->key, 1); + if(old != 0) { + runtime·printf("notewakeup - double wakeup (%d)\n", old); runtime·throw("notewakeup - double wakeup"); + } runtime·futexwakeup((uint32*)&n->key, 1); }