English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
windows, threads and sockets
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-08-07 (08:34)
From: Sylvain Le Gall <sylvain@l...>
Subject: Re: windows, threads and sockets

On 07-08-2009, Christoph Bauer <christoph.bauer@lmsintl.com> wrote:
>> > Any ideas?
>> I can't tell you explicitly why it has failed, but 
>> Unix.select was completely rewritten for OCaml 3.11.0 based 
>> on a big contribution from Sylvain Le Gall (see 
>> otherlibs/win32unix/select.c). The principal aim was to make 
>> the semantics of Unix.select the same between *NIX and 
>> Windows so if it works on Linux then it sounds like you've 
>> hit a bug...
> Good to know, I missed that change. So the new Unix.select should
> now work also on pipes? I guess it from the function named
> read_pipe_poll()
> in select.c. This is good news, because I can throw away some
> workarounds.

In no-thread context, it works great... (with pipe and console et al)

> But maybe the problem with thread is, that not
> otherlibs/win32unix/select.c
> is used. There is also otherlibs/threads/unix.ml with seems to overwrite
> Unix.select
> and there are select() calls in otherlibs/threads/scheduler.c. I'm just
> guessing
> here.

Indeed, I miss this case because I don't use thread in ocaml code.
However I don't see interaction between otherlibs/win32unix/select.c and
otherlibs/threads/unix.ml, so I am not sure where the bug comes from.

It also show that pipe/console is not available when you use select with
thread :( 

Something that can change is that we now use WinSock 2.0...

> So maybe the simples solution for me (I have to stick to 3.11.0)
> would be to create my thread in plain C, link against is and omit the
> dreaded threads library ;-) The task of my thread is very simple...

Sylvain Le Gall