List Info

Thread: "ocaml_beginners"::[] Ocaml and Threading




"ocaml_beginners"::[] Ocaml and Threading
user name
2007-01-08 08:32:48

deech_99 wrote:
> Hi all,
> I am considering Ocaml for a project where a client requests JPEG
> images from multiple databases running on remote machines.
>
> On the client GUI I want to have red/green lights that flash red when
> a database is no longer accessible.
>
> Each of these lights then is a thread that sleeps for a while, wakes
>; up, pings the server, outputs the result to the GUI and goes back to
> sleep.
>
> Given that Ocaml does not have thread support is this possible?
>
> Thanks...
> Deech
>;
>

1) Please do not oversimplify the previous discussion: Ocaml does
_definitely_ allow writing threads! There is a problem instead with
thread-based _parallelism_ (fork-like parallelism replaces it, but then
you're supposed to be on the Unix side).

2) As far as I understand, you don't need any magic to write your
program. )

3) Using LABLGTK, you'll have to use GTK threads, BUT the server can be
threaded OR forking (see examples at
http://caml.inria.fr/pub/docs/oreilly-book/index.html - Chapter 20).
Personally I'd write the server/client first and independently from the
GUI.
After that, one useful simplification is to assume that one viewer is
bound to one connection to one server; you can make modifications to
such a pattern afterwards.

4) To have red/green lights "flash", load the image for every "light"at
startup, then show/hide the one you need when you need to.

Ciao!

Ernesto

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )