From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Trouble joining with threads from C Date: Mon, 07 Mar 2011 00:56:50 -0500 Message-ID: <87y64rzd5p.fsf@netris.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1299477457 29931 80.91.229.12 (7 Mar 2011 05:57:37 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 7 Mar 2011 05:57:37 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Mar 07 06:57:33 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PwTRk-0008Ny-MC for guile-devel@m.gmane.org; Mon, 07 Mar 2011 06:57:32 +0100 Original-Received: from localhost ([127.0.0.1]:51543 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PwTRk-0007IH-5z for guile-devel@m.gmane.org; Mon, 07 Mar 2011 00:57:32 -0500 Original-Received: from [140.186.70.92] (port=36099 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PwTRS-0007Hi-OE for guile-devel@gnu.org; Mon, 07 Mar 2011 00:57:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PwTRR-00018U-N3 for guile-devel@gnu.org; Mon, 07 Mar 2011 00:57:14 -0500 Original-Received: from world.peace.net ([216.204.32.208]:39121) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PwTRR-00015k-K1 for guile-devel@gnu.org; Mon, 07 Mar 2011 00:57:13 -0500 Original-Received: from ip68-9-118-38.ri.ri.cox.net ([68.9.118.38] helo=freedomincluded) by world.peace.net with esmtpa (Exim 4.69) (envelope-from ) id 1PwTRC-00007L-1a; Mon, 07 Mar 2011 00:56:58 -0500 Original-Received: from mhw by freedomincluded with local (Exim 4.69) (envelope-from ) id 1PwTR5-0001FB-7Y; Mon, 07 Mar 2011 00:56:51 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 216.204.32.208 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:11804 Archived-At: --=-=-= Apologies in advance if I'm making a mistake here, but can someone explain to me why the minimal attached example code fails to join with its trivial spawned thread? I might guess that it's because spawn_thread() in threads.c calls scm_i_pthread_detach. So does launch_thread(). Yet the documentation of scm_join_thread seems to indicate that you ought to be able to join with a thread created by scm_spawn_thread. Thanks, Mark --=-=-= Content-Type: text/x-csrc Content-Disposition: inline; filename=test.c Content-Description: Minimal example code #include static SCM thread_main (void *data) { return SCM_BOOL_F; } static SCM thread_handler (void *data, SCM key, SCM args) { return SCM_BOOL_F; } static void * inner_main (void *data) { SCM thread = scm_spawn_thread (thread_main, 0, thread_handler, 0); SCM timeout = scm_from_unsigned_integer (time (NULL) + 20); scm_join_thread_timed (thread, timeout, SCM_BOOL_T); } int main (int argc, char **argv) { scm_with_guile (inner_main, 0); return 0; } --=-=-=--