From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 8B177BC37 for ; Sun, 27 Dec 2009 10:43:01 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuoAAHy6NkvRVdrkkGdsb2JhbACRZoIYhyY/AQEBAQkJDAcTA4g4n3yBMoN9h0MBAgMFBYQpBA X-IronPort-AV: E=Sophos;i="4.47,458,1257116400"; d="scan'208";a="40607071" Received: from mail-bw0-f228.google.com ([209.85.218.228]) by mail3-smtp-sop.national.inria.fr with ESMTP; 27 Dec 2009 10:43:01 +0100 Received: by bwz28 with SMTP id 28so7213743bwz.17 for ; Sun, 27 Dec 2009 01:43:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type:content-transfer-encoding; bh=UUJDd2vLsT8N2REtVZpaP7DesGgGLv4vSII7ikKnWa8=; b=BW6rSbIAuujWhZwtG059Gn4pT5Et1ZCRlVYKqI9ieI6AhiEtH5ab+y8RfBxFUhKq+B TqkcEXTraPJMz2j+dWA51PXcdxJFT+JYJybLHOerdI7N29Gix4aI0pQMhSqfty93X6fs ZVfv3wnsDj2Z5nYhu5oRTzuWt2PNiuXOyHWRc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; b=JS+IXyQD5cew0q9BlmkrtI1hRYMXiUqZuBLD5k08607FVKqlvldGyguMbc1x+hxLuS IvfsHa/vtixDZEoNEC1AyaT/4ETzu0QgTz3kiO8hiiu+jaWloVmLOD1mXP5PREJABjW6 8e+0WjccIWUOUi8MYr40tXTMaaviryJNfxwCo= Received: by 10.204.3.14 with SMTP id 14mr6255043bkl.128.1261906975761; Sun, 27 Dec 2009 01:42:55 -0800 (PST) Received: from lemon (138-236-133-95.pool.ukrtel.net [95.133.236.138]) by mx.google.com with ESMTPS id 14sm3089095bwz.9.2009.12.27.01.42.54 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 27 Dec 2009 01:42:54 -0800 (PST) Date: Sun, 27 Dec 2009 11:42:53 +0200 From: ygrek To: OCaml List Subject: Re: [Caml-list] Wrapping C code using pthread. Message-Id: <20091227114253.a0a9ff49.ygrekheretix@gmail.com> In-Reply-To: <4B352731.2060306@citycable.ch> References: <4B352731.2060306@citycable.ch> X-Mailer: Sylpheed 2.5.0 (GTK+ 2.12.12; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; guillaume:01 guillaume:01 segfaults:01 ocaml:01 segfaults:01 ocaml:01 callbacks:01 2009:98 wrote:01 caml-list:01 caml:02 pthreads:02 pthreads:02 fri:05 null:05 On Fri, 25 Dec 2009 21:57:21 +0100 Guillaume Yziquel wrote: > Hello. > > I'm currently trying to wrap up together a C interface for the MonetDB5 > database system. I'm getting quite a lot of segfaults (a lot of which > come from MonetDB itself), and I'm therefore wondering the following > about pthreads and OCaml: > > The server is started via a pthread: > > pthread_create(&sqlthread, NULL, start_sql_server, (void *) server); > > and I would like to know what kind of things I should look at with > C-side pthreads in order to avoid segfaults... How does the OCaml code gets executed? Via callbacks from this thread? If so, have a look at http://caml.inria.fr/mantis/view.php?id=4702 -- ygrek http://ygrek.org.ua