<s>
A	O
spurious	B-Language
wakeup	I-Language
happens	O
when	O
a	O
thread	O
wakes	O
up	O
from	O
waiting	O
on	O
a	O
condition	O
variable	O
that	O
's	O
been	O
signaled	O
,	O
only	O
to	O
discover	O
that	O
the	O
condition	O
it	O
was	O
waiting	O
for	O
is	O
n't	O
satisfied	O
.	O
</s>
<s>
But	O
spurious	B-Language
wakeup	I-Language
do	O
n't	O
happen	O
for	O
no	O
reason	O
:	O
they	O
usually	O
happen	O
because	O
,	O
in	O
between	O
the	O
time	O
when	O
the	O
condition	O
variable	O
was	O
signaled	O
and	O
when	O
the	O
waiting	O
thread	O
finally	O
ran	O
,	O
another	O
thread	O
ran	O
and	O
changed	O
the	O
condition	O
.	O
</s>
<s>
There	O
was	O
a	O
race	B-Operating_System
condition	I-Operating_System
between	O
the	O
threads	O
,	O
with	O
the	O
typical	O
result	O
that	O
sometimes	O
,	O
the	O
thread	O
waking	O
up	O
on	O
the	O
condition	O
variable	O
runs	O
first	O
,	O
winning	O
the	O
race	O
,	O
and	O
sometimes	O
it	O
runs	O
second	O
,	O
losing	O
the	O
race	O
.	O
</s>
<s>
On	O
many	O
systems	O
,	O
especially	O
multiprocessor	O
systems	O
,	O
the	O
problem	O
of	O
spurious	B-Language
wakeup	I-Language
is	O
exacerbated	O
because	O
if	O
there	O
are	O
several	O
threads	O
waiting	O
on	O
the	O
condition	O
variable	O
when	O
it	O
's	O
signaled	O
,	O
the	O
system	O
may	O
decide	O
to	O
wake	O
them	O
all	O
up	O
,	O
treating	O
every	O
signal( )	O
to	O
wake	O
one	O
thread	O
as	O
a	O
broadcast( )	O
to	O
wake	O
all	O
of	O
them	O
,	O
thus	O
breaking	O
any	O
possibly	O
expected	O
1:1	O
relationship	O
between	O
signals	O
and	O
wakeup	O
.	O
</s>
<s>
If	O
there	O
are	O
ten	O
threads	O
waiting	O
,	O
only	O
one	O
will	O
win	O
and	O
the	O
other	O
nine	O
will	O
experience	O
spurious	B-Language
wakeup	I-Language
.	O
</s>
<s>
In	O
the	O
Solaris	O
implementation	O
of	O
condition	O
variables	O
,	O
a	O
spurious	B-Language
wakeup	I-Language
may	O
occur	O
without	O
the	O
condition	O
being	O
assigned	O
if	O
the	O
process	O
is	O
signal	O
;	O
the	O
wait	O
system	O
call	O
aborts	O
and	O
returns	O
Inter	O
.	O
</s>
<s>
Because	O
spurious	B-Language
wakeup	I-Language
can	O
happen	O
whenever	O
there	O
's	O
a	O
race	O
and	O
possibly	O
even	O
in	O
the	O
absence	O
of	O
a	O
race	O
or	O
a	O
signal	O
,	O
when	O
a	O
thread	O
wakes	O
on	O
a	O
condition	O
variable	O
,	O
it	O
should	O
always	O
check	O
that	O
the	O
condition	O
it	O
sought	O
is	O
satisfied	O
.	O
</s>
