caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gerd Stolpmann <Gerd.Stolpmann@darmstadt.netsurf.de>
To: caml-list@inria.fr
Subject: Why is marshalling not thread-safe? (2.04)
Date: Thu, 13 Jan 2000 03:44:14 +0100	[thread overview]
Message-ID: <00011303584000.03639@ice> (raw)

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




                 reply	other threads:[~2000-01-13 16:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=00011303584000.03639@ice \
    --to=gerd.stolpmann@darmstadt.netsurf.de \
    --cc=caml-list@inria.fr \
    /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).