Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Why3
why3
Commits
c6332b03
Commit
c6332b03
authored
Sep 23, 2013
by
Guillaume Melquiond
Browse files
Remove unused and non-portable function call_asynchronous.
parent
5567265b
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/util/sysutil.ml
View file @
c6332b03
...
...
@@ -75,41 +75,6 @@ let open_temp_file ?(debug=false) filesuffix usefile =
close_out
cout
;
raise
e
type
'
a
result
=
|
Result
of
'
a
|
Exception
of
exn
open
Unix
exception
Bad_execution
of
process_status
let
call_asynchronous
(
f
:
unit
->
'
a
)
=
let
cin
,
cout
=
pipe
()
in
let
cin
=
in_channel_of_descr
cin
in
let
cout
=
out_channel_of_descr
cout
in
match
fork
()
with
|
0
->
let
result
=
try
Result
(
f
()
)
with
exn
->
Exception
exn
in
Marshal
.
to_channel
cout
(
result
:
'
a
result
)
[]
;
close_out
cout
;
exit
0
|
pid
->
let
f
()
=
let
result
=
(
Marshal
.
from_channel
cin
:
'
a
result
)
in
close_in
cin
;
let
_
,
ps
=
waitpid
[]
pid
in
match
ps
with
|
WEXITED
0
->
begin
match
result
with
|
Result
res
->
res
|
Exception
exn
->
raise
exn
end
|
_
->
raise
(
Bad_execution
ps
)
in
f
let
copy_file
from
to_
=
let
cin
=
open_in
from
in
let
cout
=
open_out
to_
in
...
...
src/util/sysutil.mli
View file @
c6332b03
...
...
@@ -41,19 +41,6 @@ val open_temp_file :
and call usefile on this file (filename and open_out).
usefile can close the file *)
val
call_asynchronous
:
(
unit
->
'
a
)
->
(
unit
->
'
a
)
(* Transform a synchronous call to an
asynchronous in a separate memory.
call_asynchronous f forks and run the
function in the child process. In the parent
process the function returned will wait the end
of the child process*)
(* With this function we can make fork in a thread
it is not as bad as it can be in 3.11.0 :
http://caml.inria.fr/mantis/view.php?id=4577
*)
val
copy_file
:
string
->
string
->
unit
(** [copy_file from to] copy the file from [from] to [to] *)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment