Version française
Home     About     Download     Resources     Contact us    
Browse thread
Win32 Services & O'Caml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David Allsopp <dra-news@m...>
Subject: RE: [Caml-list] Win32 Services & O'Caml
I agree --- although, unless my understanding of how Win32 does it is
completely wrong, I don't think there are any non-O'Caml threads in use.
StartServiceCtrlDispatcher is invoked by an O'Caml created thread and it
doesn't return until the very end of the service (i.e. when the service has
been totally shutdown and the process is terminating).

However, what's not clear to me is whether there are implications of an
O'Caml function calling a C-function which calls back to another C-function
which subsequently calls back to O'Caml!!


David

-----Original Message-----
From: skaller [mailto:skaller@users.sourceforge.net] 
Sent: 25 January 2007 14:54
To: David Allsopp
Cc: OCaml List
Subject: Re: [Caml-list] Win32 Services & O'Caml

On Thu, 2007-01-25 at 11:53 +0000, David Allsopp wrote:
> Yesterday I completed a module that allows construction of Win32 Services
in
> O'Caml. Non-threaded O'Caml apps seem to be working just fine but I've hit
a
> brick wall with multi-threaded applications.

I'm sure Xavier will fix my misconceptions here, but I suspect
the requirement is that Ocaml threading library must start the
threads so it can arrange for state to be properly shared,
in particular the heap. If other code starts the thread,
when it makes a callback into Ocaml, Ocaml can't find
the shared state because it was never established.

Any system (not just Ocaml) is going to have this problem
if it uses an environment not strictly conforming to that
provided natively. EG .. how do you share a young heap
pointer held in an AMD64 machine register across threads ..
when the OS carefully makes sure registers are not shared?? :)


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net