summaryrefslogtreecommitdiffstats
path: root/otherlibs
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1996-04-02 11:55:16 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1996-04-02 11:55:16 +0000
commitce9ffc8ece33f55f44fa2f81790166ba6f958c73 (patch)
tree87fce683d8c6d38d4872df20bb42f27c7ed2a43a /otherlibs
parent72d5eb55e12469e909e5ee8c5f7a3141b57320b4 (diff)
Ajout d'un mutex pour rendre ca thread-safe
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@728 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs')
-rw-r--r--otherlibs/threads/Tests/sorts.ml6
1 files changed, 5 insertions, 1 deletions
diff --git a/otherlibs/threads/Tests/sorts.ml b/otherlibs/threads/Tests/sorts.ml
index ebdc61dac..184cda455 100644
--- a/otherlibs/threads/Tests/sorts.ml
+++ b/otherlibs/threads/Tests/sorts.ml
@@ -17,15 +17,19 @@ type graphic_context =
(* Array assignment and exchange with screen update *)
+let screen_mutex = Mutex.new()
+
let draw gc i v =
fill_rect (gc.x0 + (gc.width * i) / gc.nelts)
(gc.y0 + (gc.height * v) / gc.maxval)
gc.rad gc.rad
let assign gc i v =
+ Mutex.lock screen_mutex;
set_color background; draw gc i gc.array.(i);
set_color foreground; draw gc i v;
- gc.array.(i) <- v
+ gc.array.(i) <- v;
+ Mutex.unlock screen_mutex
let exchange gc i j =
let val_i = gc.array.(i) in