summaryrefslogtreecommitdiff
path: root/ext/Thread
diff options
context:
space:
mode:
Diffstat (limited to 'ext/Thread')
-rw-r--r--ext/Thread/Thread.xs2
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/Thread/Thread.xs b/ext/Thread/Thread.xs
index f8b544da91..5d61941241 100644
--- a/ext/Thread/Thread.xs
+++ b/ext/Thread/Thread.xs
@@ -353,6 +353,8 @@ join(t)
int i = NO_INIT
PPCODE:
#ifdef USE_THREADS
+ if (t == thr)
+ croak("Attempt to join self");
DEBUG_S(PerlIO_printf(PerlIO_stderr(), "%p: joining %p (state %u)\n",
thr, t, ThrSTATE(t)););
MUTEX_LOCK(&t->mutex);