From 4380fa6d99284c03e471bafcb1be2db83b225af4 Mon Sep 17 00:00:00 2001 From: Dmitriy Vyukov Date: Mon, 24 Dec 2012 21:06:57 +0400 Subject: [PATCH] runtime: diagnose double wakeup on Note Double wakeup is prohibited by the Note interface and checked in lock_sema.c. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/6976054 --- src/pkg/runtime/lock_futex.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pkg/runtime/lock_futex.c b/src/pkg/runtime/lock_futex.c index b4465bff18d..9b1f5f6db43 100644 --- a/src/pkg/runtime/lock_futex.c +++ b/src/pkg/runtime/lock_futex.c @@ -111,7 +111,8 @@ runtime·noteclear(Note *n) void runtime·notewakeup(Note *n) { - runtime·xchg(&n->key, 1); + if(runtime·xchg(&n->key, 1)) + runtime·throw("notewakeup - double wakeup"); runtime·futexwakeup(&n->key, 1); }