From owner-freebsd-hackers Mon Mar 9 12:23:52 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA26195 for freebsd-hackers-outgoing; Mon, 9 Mar 1998 12:23:52 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from cheddar.netmonger.net (chris@cheddar.netmonger.net [209.54.21.140]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id MAA26152 for ; Mon, 9 Mar 1998 12:23:42 -0800 (PST) (envelope-from chris@cheddar.netmonger.net) Received: (from chris@localhost) by cheddar.netmonger.net (8.8.8/8.8.8) id PAA27698; Mon, 9 Mar 1998 15:23:32 -0500 (EST) Message-ID: <19980309152332.35831@netmonger.net> Date: Mon, 9 Mar 1998 15:23:32 -0500 From: Christopher Masto To: perl5-porters@perl.com, nvp@mediaone.net Cc: hackers@FreeBSD.ORG Subject: Perl, Threads, FreeBSD, High Weirdness Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.87.4 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Here are the latest results of my investigations into _62's thread situation: First, I'm 95% sure that the test suite is broken: sub islocked { use attrs 'locked'; my $val = shift; my $ret; if (@_) { $ret = new Thread \&islocked,shift; sleep 2; } print $val; } $t = islocked("ok 6\n","ok 7\n"); join $t; That 'join $t;' should be '$t->join;'. It's being interpreted as a Perl join, not a thread join. Further, in order for that to be of any use, islocked() should return $ret at the end. There's also another 'join $t' mistake in the next (8/9) test. Now the more sad part with FreeBSD: # test that sleep lets other thread run $t = new Thread \&islocked,"ok 8\n"; sleep 6; print "ok 9"; join $t; Pretending the last line is fixed, this test still fails on FreeBSD (2.2.5-stable as of yesterday). I don't know why, but I do know that threads are simply not working. They do not run concurrently. This test program: use Thread; $t = Thread->new(sub { print "AAA\n" while 1; }); while (1) { print "---\n"; sleep 1; } Produces this output: --- --- --- --- --- (ad infinitum) If the main program ever performs a $t->join or exits, the AAA thread takes over and actually can't be stopped with a ^C or ^\ (but kill -9 from another session works). Either I'm completely misunderstanding the semantics of the Thread stuff (the documentation _is_ a bit skimpy right now (I will try to help remedy that if I ever get this working)), or something's truly screwy. I'm encouraged by the fact that it compiles, links, and runs.. this is much more than used to happen. But it don't go right. -- Christopher Masto Director of Operations, NetMonger Communications, Inc. +1-516-221-6664 http://www.netmonger.net/ info@netmonger.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message