Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Zheng Li <li@pps.jussieu.fr>
To: caml-list@inria.fr
Subject: Why thread.cmi of vmthreads/systhreads different
Date: Fri, 27 Jul 2007 11:15:35 +0200	[thread overview]
Message-ID: <87bqdyw6ko.fsf@pps.jussieu.fr> (raw)


Hi

I found that the thread.cmi in $STDLIB/vmthreads and $STDLIB/threads are
different, while others interface files (event.cmi, condition.cmi and
mutex.cmi) are the same.

By looking at the source, I found that the slight differences coming from two
thread.mli on the following aspects:

1) a few values explicitly declared as "external" in the interfaces hence
different from each other, as the implementations vary. e.g

  +val self : unit -> t     
  -external self : unit -> t = "caml_thread_self"

  +external id : t -> int = "thread_id"   
  -external id : t -> int = "caml_thread_id"

However, by substituting "external" with "val" can obviously unify them. Is
there any special reasons, except slight efficiency difference, to keep them
external in the interface?

2) values "sleep", "wakeup" "critical_section" only exist in vmthread and
"sigmask" only exist in systhreads. However,

 - Isn't it possible to complete these slots with dummy functions on both
   sides so that they can agree? Especially, "sleep" etc. are for internal use
   only and hidden from the doc by default, besides there already exist some
   precedents like that (e.g. wait_read and wait_right of systhreads)

 - The Thread module section of OCaml manual seems to be generated from the
   systhreads interface, then how about if I call Thread.sigmask on vmthreads?

My point is that two different versions of thread.cmi greatly reduce the
flexibility. I don't see many obstacles to make them agree, but I'm not sure
whether there exist other factors to prevent that from happening. On the other
hand, if this would never happen (officially), I'm fine with wrapping a common
interface module, just a bit strange.

-- 
Zheng Li
http://www.pps.jussieu.fr/~li


             reply	other threads:[~2007-07-27  9:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-27  9:15 Zheng Li [this message]
2007-07-27 15:33 ` [Caml-list] " Chris King

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=87bqdyw6ko.fsf@pps.jussieu.fr \
    --to=li@pps.jussieu.fr \
    --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