You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4666 Reporter: gguyomarch Assigned to:@xavierleroy Status: closed (set by @xavierleroy on 2009-01-26T17:15:28Z) Resolution: fixed Priority: normal Severity: major Version: 3.11.0+beta Fixed in version: 3.11.1+dev Category: ~DO NOT USE (was: OCaml general) Related to:#4725 Monitored by: spivey hnrgrgr gguyomarch
Bug description
Prior to bug fix for #2867, threaded programs could overcome the following limitation of mac os x execve (execv failing with EOPNOTSUPP when a process as multiple active threads):
I do not know if there is a right thing to do though.
Thanks,
Gregory.
(* fork_exec.ml )
( Compiled with:
ocamlbuild -tag use_unix -cflags "-I +vmthreads" -lflags "-I +vmthreads" -libs unix,threads fork_exec.byte
works on mac os x, but with the following, it will fails in execvp with EOPNOTSUPP in 3.11:
ocamlbuild -tag use_unix -cflags "-I +threads" -lflags "-I +threads" -libs unix,threads fork_exec.byte
Used to work in 3.10.2.
*)
let () =
let t = Thread.create (fun () -> ()) () in
Thread.join t;
Unix.handle_unix_error
(fun () ->
match Unix.fork () with
| 0 -> Unix.execvp "ls" [| "ls"; "-l" |];
| pid -> ()
) ();
;;
Gregoire Henri said:
#4577: reinitialize thread machinery after fork #4577
The trick of systematically calling fork before exec in a threaded
program does not work anymore, because the ocaml Unix.fork restart a
thread after forking.
The text was updated successfully, but these errors were encountered:
That's a nasty bug in MacOS X. One possible fix would be to create the 'tick' thread on demand, i.e. the first time a thread is created after the initial launch of the program or after a fork (in the child process). I'll look into this.
I wanted to add a note in Mantis (but couldn't see how to do it) to say
that I had encountered the problem described in #4666 in a program that
contains OCaml + LablGTK + GTK+OSX + threads + sockets. The fix that is
in the 3.11 release branch on CVS solved the problem for me.
Original bug ID: 4666
Reporter: gguyomarch
Assigned to: @xavierleroy
Status: closed (set by @xavierleroy on 2009-01-26T17:15:28Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 3.11.0+beta
Fixed in version: 3.11.1+dev
Category: ~DO NOT USE (was: OCaml general)
Related to: #4725
Monitored by: spivey hnrgrgr gguyomarch
Bug description
Prior to bug fix for #2867, threaded programs could overcome the following limitation of mac os x execve (execv failing with EOPNOTSUPP when a process as multiple active threads):
http://uninformed.org/index.cgi?v=1&a=1&p=16
http://lists.apple.com/archives/cocoa-dev/2005/Oct/msg00836.html
by forking first, see example below.
I do not know if there is a right thing to do though.
Thanks,
Gregory.
(* fork_exec.ml )
( Compiled with:
ocamlbuild -tag use_unix -cflags "-I +vmthreads" -lflags "-I +vmthreads" -libs unix,threads fork_exec.byte
works on mac os x, but with the following, it will fails in execvp with EOPNOTSUPP in 3.11:
ocamlbuild -tag use_unix -cflags "-I +threads" -lflags "-I +threads" -libs unix,threads fork_exec.byte
Used to work in 3.10.2.
*)
let () =
let t = Thread.create (fun () -> ()) () in
Thread.join t;
Unix.handle_unix_error
(fun () ->
match Unix.fork () with
| 0 -> Unix.execvp "ls" [| "ls"; "-l" |];
| pid -> ()
) ();
;;
Gregoire Henri said:
The text was updated successfully, but these errors were encountered: