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: 1524 Reporter: administrator Status: closed Resolution: won't fix Priority: normal Severity: feature Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Chris Uzdavinis
Version: 3.06
OS: Linux 7.2 (enigma) and 7.3 (Valhalla)
Submission from: external.atdesk.com (63.68.0.194)
The following program does not terminate. One of the threads is not being
scheduled. This problem occurs only when compiled to native code. With
bytecode, it works correctly. (I built ocaml with -with-pthread option).
let keep_going = ref true;;
let n = ref 0;;
let f_proc1 () =
while !keep_going do
incr n;
done
let f_proc2 () =
let t2 = Thread.create f_proc1 () in
let t3 = Thread.create f_proc1 () in
Thread.delay 3.0; (* Problem here: never returns *)
Printf.printf "exiting f_proc2...\n";
flush stdout;;
let t1 = Thread.create f_proc2 () in
Thread.join t1;
Printf.printf "exiting main thread...\n"
Workaround:
If I put a "Thread.yield ()" call into the f_proc1 loop (or any call to delay in
the loop), then everything properly executes. I don't think this should be
necessary, though.
What concerns me the most is different behavior at runtime depending on the
compiler used (native or bytecode.)
The text was updated successfully, but these errors were encountered:
Bytecode and native-code poll for context switching at different times.
Native polls at allocation points only. That explains the difference.
It is unlikely that we'll introduce more poll points in generated native code.
Original bug ID: 1524
Reporter: administrator
Status: closed
Resolution: won't fix
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Chris Uzdavinis
Version: 3.06
OS: Linux 7.2 (enigma) and 7.3 (Valhalla)
Submission from: external.atdesk.com (63.68.0.194)
The following program does not terminate. One of the threads is not being
scheduled. This problem occurs only when compiled to native code. With
bytecode, it works correctly. (I built ocaml with -with-pthread option).
let keep_going = ref true;;
let n = ref 0;;
let f_proc1 () =
while !keep_going do
incr n;
done
let f_proc2 () =
let t2 = Thread.create f_proc1 () in
let t3 = Thread.create f_proc1 () in
Thread.delay 3.0; (* Problem here: never returns *)
Printf.printf "exiting f_proc2...\n";
flush stdout;;
let t1 = Thread.create f_proc2 () in
Thread.join t1;
Printf.printf "exiting main thread...\n"
Workaround:
If I put a "Thread.yield ()" call into the f_proc1 loop (or any call to delay in
the loop), then everything properly executes. I don't think this should be
necessary, though.
What concerns me the most is different behavior at runtime depending on the
compiler used (native or bytecode.)
The text was updated successfully, but these errors were encountered: