return $ok;
}
+ok(2, scalar @{[threads->list]} == 0);
-ok(2, threads->self == (threads->list)[0]);
threads->create(sub {})->join();
-ok(3, scalar @{[threads->list]} == 1);
+ok(3, scalar @{[threads->list]} == 0);
my $thread = threads->create(sub {});
-ok(4, scalar @{[threads->list]} == 2);
+ok(4, scalar @{[threads->list]} == 1);
$thread->join();
-ok(5, scalar @{[threads->list]} == 1);
+ok(5, scalar @{[threads->list]} == 0);
-$thread = threads->create(sub { ok(6, threads->self == (threads->list)[1])});
+$thread = threads->create(sub { ok(6, threads->self == (threads->list)[0])});
threads->yield; # help out non-preemptive thread implementations
sleep 1;
-ok(7, $thread == (threads->list)[1]);
+ok(7, $thread == (threads->list)[0]);
$thread->join();
-ok(8, scalar @{[threads->list]} == 1);
+ok(8, scalar @{[threads->list]} == 0);
ithread *curr_thread;
MUTEX_LOCK(&create_destruct_mutex);
curr_thread = threads;
- PUSHs( sv_2mortal(ithread_to_SV(aTHX_ NULL, curr_thread, classname, TRUE)));
+ if(curr_thread->tid != 0)
+ PUSHs( sv_2mortal(ithread_to_SV(aTHX_ NULL, curr_thread, classname, TRUE)));
while(curr_thread) {
curr_thread = curr_thread->next;
if(curr_thread == threads)
break;
if(curr_thread->state & PERL_ITHR_DETACHED ||
- curr_thread->state & PERL_ITHR_JOINED)
- continue;
- PUSHs( sv_2mortal(ithread_to_SV(aTHX_ NULL, curr_thread, classname, TRUE)));
+ curr_thread->state & PERL_ITHR_JOINED)
+ continue;
+ PUSHs( sv_2mortal(ithread_to_SV(aTHX_ NULL, curr_thread, classname, TRUE)));
}
MUTEX_UNLOCK(&create_destruct_mutex);
}