Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004554OCamlotherlibspublic2008-05-17 05:572016-12-07 17:44
Assigned To 
PlatformOSOS Version
Product Version3.10.2 
Target VersionFixed in Version 
Summary0004554: Patch implementing inter-thread shared variable without creating a new thread.
First of all, thanks for the excellent job.

I would like to suggest a new feature about Event module.

Event module provides CML style synchronous communication methods,
but does not support shared variables like ivar, mvar.
These variables are REALLY necessary for multi-thread programming.

So, I have implemented shared variable module called 'Cell'.

1. With 'Cell', we can make ivar, mvar, thread-safe queue, broadcast channel,
 and timeout event easily.

2. 'Cell' dose not create a new thread. This is IMPORTANT. It means the shared
variable is GC target. If the variable has a thread, it is impossible to garbage
collect automatically.
# But, to make such shared variable with Event module, Cell module is inside of
# Event module because implementation detail of Event.event type is needed.

Type of Cell module inside Event module is as follow:

module type Cell = sig
  type 'a t
  val make : unit -> 'a t
  val init_make : 'a -> 'a t
  val put : 'a t -> 'a -> unit Event.event
  val take : 'a t -> 'a Event.event
  val read : 'a t -> 'a Event.event
  val overwrite : 'a t -> ('a -> 'a) -> unit Event.event

I'm sending a patch to Event module with some sample code for testing.



Attached Filesgz file icon event_module_patch.tar.gz [^] (2,498 bytes) 2008-05-17 05:57
gz file icon event_module_patch_2.tar.gz [^] (7,674 bytes) 2008-06-20 17:11

- Relationships

-  Notes
ogasawara (reporter)
2008-06-20 17:15

I found that first version patch had several bugs.
I have made more tested version and uploaded.

- Issue History
Date Modified Username Field Change
2008-05-17 05:57 ogasawara New Issue
2008-05-17 05:57 ogasawara File Added: event_module_patch.tar.gz
2008-06-20 17:11 ogasawara File Added: event_module_patch_2.tar.gz
2008-06-20 17:15 ogasawara Note Added: 0004523
2008-09-23 19:41 doligez Status new => acknowledged
2013-09-04 17:59 doligez Tag Attached: patch
2016-12-07 17:44 shinwell Category OCaml general => OCaml otherlibs
2017-02-23 16:42 doligez Category OCaml otherlibs => otherlibs

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker