Skip to content

Commit

Permalink
Lock et Unlock peuvent declencher un context switch, donc mettre en r…
Browse files Browse the repository at this point in the history
…acines tout ce qui doit survivre

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1858 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information
xavierleroy committed Dec 11, 1997
1 parent 09e66e6 commit 1c0387d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
8 changes: 5 additions & 3 deletions byterun/extern.c
Expand Up @@ -400,9 +400,11 @@ void output_val(struct channel *chan, value v, value flags)
value output_value(value vchan, value v, value flags) /* ML */
{
struct channel * channel = Channel(vchan);
Lock(channel);
output_val(channel, v, flags);
Unlock(channel);
Begin_root(v)
Lock(channel);
output_val(channel, v, flags);
Unlock(channel);
End_roots();
return Val_unit;
}

Expand Down
10 changes: 6 additions & 4 deletions byterun/intern.c
Expand Up @@ -296,11 +296,13 @@ value input_val(struct channel *chan)
value input_value(value vchan) /* ML */
{
struct channel * chan = Channel(vchan);
value res;
value res = Val_unit;

Lock(chan);
res = input_val(chan);
Unlock(chan);
Begin_root(res)
Lock(chan);
res = input_val(chan);
Unlock(chan);
End_roots();
return res;
}

Expand Down

0 comments on commit 1c0387d

Please sign in to comment.