Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Interfacing C threads with Ocaml - weird bug
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: ronniec95@l...
Subject: Re: [Caml-list] Interfacing C threads with Ocaml - weird bug
On Wednesday 03 April 2002 at 16:43PM, Olivier Andrieu attributed that:
>  ronniec95@lineone.net [Tuesday 2 April 2002] :
>  >
>  > Hi guys,
>  > 
>  > I've written a Ocaml interface for an C-API. It sets up some parameters
>  > (all works) then starts a thread pool (C). I then call a mainloop
>  > function that contains a while loop that, upon receiving a request
>  > dispatches the event to a C callback.
>  > 
>  > OCAML:
>  > let receiver () = 
>  >                     let _ = Tib.opent ()
>  >                     and tport = Tib.create_transport "" "" ""
>  >                     and queue = Tib.default_queue () in
> 
> (...)
> 
>  > Any ideas (very) helpful.
> 
> Hi, maybe you've solved your problem already but I have a comment on
> your code : 
> you use ? let _ = ... and tport = ... and queue = ... ?. Now I'm not
> sure in which order the evaluation takes place in case of ? let
> ... and ... ? construct : actually the manual says it's
> "unspecified". Since Tib.opent should be evaluated before everything
> else I guess, I'd say it's better to use ? let _ = Tib.opent () in let
> tport = ... ?.

Hmm - it appears to work with either construct, but as you say, it's
obviously incorrect to rely on this. I had assumed that the only reason
you have to use 'in' is when you will be using the result of a previous
calculation.

So I've also fixed this (potential) bug.

> 
> But your threads problem is probably unrelated to this.
> 

Using classic divide and conquer I managed to track down the thread bug
to an incorrect Field(x,y) macro earlier in the initialisation.

Thanks for all the help

Regards

Ronnie

> -- 
>    Olivier

-- 
->=======================================<-
 name:  ronnie m chowdhury 
 mobile:+971-50-566-4437
 tel:	+971-2-681-7600
 fax:	+971-2-681-7900

 addr:   1304, three sails towers
         corniche road west
         abu dhabi
         po box 41876,
         united arab emirates
->=======================================<-
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners