caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Why is marshalling not thread-safe? (2.04)
@ 2000-01-13  2:44 Gerd Stolpmann
  0 siblings, 0 replies; only message in thread
From: Gerd Stolpmann @ 2000-01-13  2:44 UTC (permalink / raw)
  To: caml-list

Hi,

I'm currently writing a multi-threaded server which communicates with its
clients by O'caml's marshalling module. After some segfaults I found out that
the output_value and input_value primitives are not thread-safe, because there
are some global variables (extern_table, intern_input) for which there is only
one instance for all threads. (The segfaults happened when one of these
variables was freed.)

The code contains some mutexes, but these mutexes only protect the structures
of the channels, and not these global variables. So I think that thread-safety
was intended but never checked, am I right?

At the first glance, there seems to be a simple solution of the problem,
because it is possible to avoid these global variables and pass them as
arguments to the functions needing them. But I did not check this in detail.

Is it possible to get marshalling reentrant? A multi-threaded server is more
or less senseless if marshalling is serialized.

Gerd
-- 
----------------------------------------------------------------------------
Gerd Stolpmann      Telefon: +49 6151 997705 (privat)
Viktoriastr. 100             
64293 Darmstadt     EMail:   Gerd.Stolpmann@darmstadt.netsurf.de (privat)
Germany                     
----------------------------------------------------------------------------




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-01-13 16:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-13  2:44 Why is marshalling not thread-safe? (2.04) Gerd Stolpmann

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).