From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr 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 D5C48BC57 for ; Tue, 13 Apr 2010 23:56:36 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Am0BAMeFxEtKfVI0mGdsb2JhbACDFIwkggCKCQgVAQEBAQEICQwHESKsKTeBcIYuLohNAQEDBYIQRoFEbgSDRA X-IronPort-AV: E=Sophos;i="4.52,200,1270418400"; d="scan'208";a="48434926" Received: from mail-ww0-f52.google.com ([74.125.82.52]) by mail3-smtp-sop.national.inria.fr with ESMTP; 13 Apr 2010 23:56:36 +0200 Received: by wwb39 with SMTP id 39so883621wwb.39 for ; Tue, 13 Apr 2010 14:56:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:received:message-id:subject:to:cc:content-type; bh=4SlPx/e0CTu9w0JBb9MVvhoA6SEElFey1+uA8jO0Wqg=; b=UipU+O1q5n43nqGJBl4cvJ9RiBup4rnf7FVfn2XS3aedklECg7ebkhJ2RTHfapm0ep QLmZ1eqJMnNHQZydQbT3SMNdokh29SpY5jRvtPHKndpwJVhe3QjVIz3jDSExEWtrY75z TMWvzx3EXfY7mfksWhGKxR1Aovo9rY64HSaec= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=O50MySjzvOgwJjB3Yfdg01vF9ssS0V60Db4h/zoO9uI4BZIKbHbEv/iap/hIQT5mU+ OZ2n2frfC3gcaquNfpl1f9CZF2mt9PtH8Kqkp4jZWpZ2JLPS/Ptuu5jqeLGtVIZRHWzM 7ewKXe712onK7Ee1XIahx1rKyNYKGSE6v4Xhc= MIME-Version: 1.0 Received: by 10.216.6.90 with HTTP; Tue, 13 Apr 2010 14:56:06 -0700 (PDT) In-Reply-To: References: From: Gregory Malecha Date: Tue, 13 Apr 2010 17:56:06 -0400 Received: by 10.216.176.206 with SMTP id b56mr3932608wem.63.1271195796099; Tue, 13 Apr 2010 14:56:36 -0700 (PDT) Message-ID: Subject: Re: [Caml-list] Threads Scheduling To: =?UTF-8?Q?Daniel_B=C3=BCnzli?= Cc: caml-list@yquem.inria.fr Content-Type: multipart/alternative; boundary=001485f1e36edddedc0484255506 X-Spam: no; 0.00; atomically:01 buenzli:01 beginner's:01 ocaml:01 bug:01 atomically:01 bunzli:01 buenzli:01 beginner's:01 ocaml:01 bug:01 threads:01 threads:01 beginners:01 beginners:01 X-Attachments: cset="UTF-8" cset="UTF-8" --001485f1e36edddedc0484255506 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Jake, The documentation for Condition.wait says: wait c m atomically unlocks the mutex m and suspends the calling process on the condition variable c. The process will restart after the condition variable c has been signalled. The mutex m is locked again before wait returns. I figured that I needed to lock and unlock the mutex in the child threads because otherwise it is possible for the condition variable to be signaled before the main thread waits, which I thought means that the signal is lost. Thanks Daniel, I'll take a look at it. On Tue, Apr 13, 2010 at 5:04 PM, Daniel B=C3=BCnzli wrote: > You may also be interested in this thread [1]. > > Daniel > > [1] > http://groups.google.com/group/fa.caml/browse_thread/thread/9606b618dab79= fb5 > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > --=20 gregory malecha --001485f1e36edddedc0484255506 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Jake,

The documentation for Condition.wait says:<= div>
wait c m atomically unlocks the mutex m and suspends the= calling process on the condition variable c. The process will restart afte= r the condition variable c has been signalled. The mutex m is locked again = before wait returns.

I figured that I needed to lock and unlock the mutex in= the child threads because otherwise it is possible for the condition varia= ble to be signaled before the main thread waits, which I thought means that= the signal is lost.=C2=A0

Thanks Daniel, I'll take a look at it.

On Tue, Apr 13, 2010 at 5:04 PM, Daniel B=C3=BCnzli= <danie= l.buenzli@erratique.ch> wrote:
You may also be interested in this thread [= 1].

Daniel

[1] http://groups.google.com/group/fa.caml/= browse_thread/thread/9606b618dab79fb5

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.in= ria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs



--
gregory mal= echa
--001485f1e36edddedc0484255506--