From: Ker Lutyn <ker527mail@yahoo.com>
To: caml-list@inria.fr
Subject: Are unreachable threads garbage collected?
Date: Sat, 3 Dec 2005 15:47:22 -0800 (PST) [thread overview]
Message-ID: <20051203234722.9365.qmail@web34602.mail.mud.yahoo.com> (raw)
>From Reppy's paper, an implementation of buffered channels translated to OCaml.
Note the internal thread to manage the state. If the buffered channel becomes
unreachable, will this thread be garbage collected?
module Buffered_channel = struct
open Event
type 'a t = 'a channel * 'a channel
let make () =
let i = new_channel () in
let o = new_channel () in
let rec loop = function
| [], [] -> loop ([sync (receive i)], [])
| (a :: aa) as aaa, bbb -> select [
wrap (receive i) (fun x -> loop (aaa, x :: bbb));
wrap (send o a) (fun () -> loop (aa, bbb))
]
| [], bbb -> loop (List.rev bbb, [])
in ignore (Thread.create loop ([], [])); (i, o)
let send (i, _) x = Event.send i x
let receive (_, o) = Event.receive o
end
__________________________________
Start your day with Yahoo! - Make it your home page!
http://www.yahoo.com/r/hs
reply other threads:[~2005-12-03 23:47 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=20051203234722.9365.qmail@web34602.mail.mud.yahoo.com \
--to=ker527mail@yahoo.com \
--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