caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christoph Bauer <christoph.bauer@lms-gmbh.de>
To: Jonathan Roewen <jonathan.roewen@gmail.com>,
	Nathaniel Gray <n8gray@gmail.com>
Cc: Caml Mailing List <caml-list@yquem.inria.fr>
Subject: AW: [Caml-list] Re: Select on channels (again)
Date: Wed, 23 Aug 2006 09:02:44 +0200	[thread overview]
Message-ID: <26EB47FDD566A7469FC862DAF373792F018CF5D0@kaiserslautern1.lmsintl.com> (raw)

 

> Why can't you just use the unix file opening functions since 
> you're using unix select? And if you need the ocaml in/out 
> channels, convert the unix file descriptors to ocaml ones 
> instead of the other way around. Seems simple enough to me.

I did this, but on windows with two programs communicating over
a pipe this isn't enough. select on windows and on a pipe doesn't
work. Therefore I wrote a stub for PeekNamedPipe():

#include <caml/unixsupport.h>
#include <windows.h>

CAMLprim value peeknamedpipe_stub( value fd ) {
  CAMLparam1( fd );
  DWORD available;
  if( !PeekNamedPipe( Handle_val( fd ), NULL, 0, NULL, &available, NULL ) )
{
    failwith( "peeknamedpipe failed");
  }
  CAMLreturn( Val_int( available ) );
}

I use select on Unix and peednamedpipe on windows. 


Communication over sockets could be another solution, because then select
should work on windows, too.

Christoph Bauer


             reply	other threads:[~2006-08-23  7:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-23  7:02 Christoph Bauer [this message]
2006-08-23  7:44 ` Robert Roessler

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=26EB47FDD566A7469FC862DAF373792F018CF5D0@kaiserslautern1.lmsintl.com \
    --to=christoph.bauer@lms-gmbh.de \
    --cc=caml-list@yquem.inria.fr \
    --cc=jonathan.roewen@gmail.com \
    --cc=n8gray@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).