From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 28 21:33:37 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CAF3216A417 for ; Tue, 28 Nov 2006 21:33:37 +0000 (UTC) (envelope-from youshi10@u.washington.edu) Received: from mxout5.cac.washington.edu (mxout5.cac.washington.edu [140.142.32.135]) by mx1.FreeBSD.org (Postfix) with ESMTP id BAC5D43CA4 for ; Tue, 28 Nov 2006 21:33:20 +0000 (GMT) (envelope-from youshi10@u.washington.edu) Received: from smtp.washington.edu (smtp.washington.edu [140.142.32.139]) by mxout5.cac.washington.edu (8.13.7+UW06.06/8.13.7+UW06.09) with ESMTP id kASLWt68030312 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 28 Nov 2006 13:32:55 -0800 X-Auth-Received: from [128.208.5.99] (nilakantha.cs.washington.edu [128.208.5.99]) (authenticated authid=youshi10) by smtp.washington.edu (8.13.7+UW06.06/8.13.7+UW06.09) with ESMTP id kASLWsls029770 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 28 Nov 2006 13:32:55 -0800 Message-ID: <456CAB12.9070507@u.washington.edu> Date: Tue, 28 Nov 2006 13:33:06 -0800 From: Garrett Cooper User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version: 5.2.2.285561, Antispam-Engine: 2.5.0.283055, Antispam-Data: 2006.11.28.131932 X-Uwash-Spam: Gauge=IIIIIII, Probability=7%, Report='__CP_NAME_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0, __USER_AGENT 0' Subject: pthreads : questions about concurrency and lifetime X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2006 21:33:37 -0000 Hello once again, Just wondering about pthreads now. I know that the lifetime (scope) of a regular procedural function in C is simple.. it's from the top of the function body to the bottom of the function body (assuming no infinite loops are injected). Example: (void*) function(void*) {/* lifetime of function is here. */ } However looking over pthread(3), there are a number of different functions for killing threads and exiting child threads, in order terminate child threads (and maybe to get back to the main thread of execution in a program). So my question is, once the end of a function body is reached that was made using pthread_create(), does the thread exit and 'destroy' itself or do I need to do 'manual' cleanup, i.e. run pthread_detach(3), pthread_exit(3), or pthread_kill(3)? Thanks! -Garrett