From: Sylvain Le Gall <sylvain@le-gall.net>
To: caml-list@inria.fr
Subject: Re: windows, threads and sockets
Date: Fri, 7 Aug 2009 10:06:59 +0000 (UTC) [thread overview]
Message-ID: <slrnh7nv63.rtu.sylvain@gallu.homelinux.org> (raw)
In-Reply-To: <BB046CA812535C45BD0029AA9D04BA7906700E33@KL-SRV57.lmsintl.com>
Hello,
On 07-08-2009, Christoph Bauer <christoph.bauer@lmsintl.com> wrote:
>
>> Do you mean that the following code is wrong with 3.11.1 and
>> not 3.10.2:
>>
>> let res_listener = Unix.select listOfSockets [] [] timeout in
>> (List.nth res_listener 0) = listenSocket
>>
>> Can you find listenSocket in the result elsewhere ?
>
> No! I try to clarify:
>
> my check is then
>
> match Unix.select sockets [] [] timeout with
> | (l,_,_) ->
> List.iter (fun sock -> printf "%b,%b\n" (List.mem sock
> sockets) (List.memq sock sockets)) l
>
> I only use OCaml 3.11.0. It only happens on windows.
>
> If I compile and link with -thread and link with ocamlfind ... -package
> threads
> then the result is
>
> false,false
>
> But without the thread package the result is
>
> true,true
>
Maybe, I understand the bug. I use "lpOrig = (void *)fd;" where fd is an
OCaml value (in select.c). Without thread and during the
enter/leave_blocking_section(), there is less chance to trigger the GC
and to modify "fd" value. This is the reason why it seems correct
without thread and fall into a bug with thread.
The obvious solution is to replace "lpOrig = (void *)fd" by a non-OCaml
value (e.g. EMode + nth in ocaml list).
Could you reduce your bug to the smallest possible program and submit
the bug on OCaml bug tracking ?
>
> BTW, I use systhreads, but the files (scheduler.c, unix.ml) I mentioned
> before are used in the vmthread case.
> In otherlibs\systhreads\threadUnix.ml I found
>
> let select = Unix.select
>
This remains another bug (less important) since we cannot use
-vmthreads, Unix.select and pipes on windows.
Regards,
Sylvain Le Gall
next prev parent reply other threads:[~2009-08-07 10:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-07 7:43 Christoph Bauer
2009-08-07 7:54 ` [Caml-list] " David Allsopp
2009-08-07 8:17 ` Christoph Bauer
2009-08-07 8:34 ` Sylvain Le Gall
2009-08-07 8:39 ` Sylvain Le Gall
2009-08-07 9:30 ` [Caml-list] " Christoph Bauer
2009-08-07 10:06 ` Sylvain Le Gall [this message]
2009-08-07 10:55 ` Christoph Bauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=slrnh7nv63.rtu.sylvain@gallu.homelinux.org \
--to=sylvain@le-gall.net \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox