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: 24 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
The following piece of code "q.ml", compiled with
ocamlopt -o q -thread unix.cmxa threads.cmxa q.ml -cclib -lunix -cclib
-lthreadsnat -cclib -pthread
does not work if "n" is less than 1024.
"q.data" is a file with contents "abcd\n".
If it works correctly, the program must not produce any output.
let n = 1023 in
for i = 1 to 50 do (* 50 threads doing I/O )
let id =
Thread.create
(fun () ->
for j = 1 to 100 do ( read the file 100 times *)
let ch = open_in "q.data" in
let u =
let s = String.create n in
ignore(input ch s 0 5);
String.sub s 0 5
in
close_in ch;
if u <> "abcd\n" then
let v =
Printf.sprintf "i=%d j=%d s=%s\n" i j u in
prerr_endline v;
done;
)
()
in
l := id :: !l
done;
List.iter
(fun id ->
Thread.join id)
!l
;;
The text was updated successfully, but these errors were encountered:
Original bug ID: 24
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Gerd Stolpmann
Version: 2.04 -with-pthread
OS: Linux-2.2.13 with glibc-6.1
Submission from: master.proxy.ision.net (195.180.208.40)
The following piece of code "q.ml", compiled with
ocamlopt -o q -thread unix.cmxa threads.cmxa q.ml -cclib -lunix -cclib
-lthreadsnat -cclib -pthread
does not work if "n" is less than 1024.
"q.data" is a file with contents "abcd\n".
If it works correctly, the program must not produce any output.
let n = 1023 in
for i = 1 to 50 do (* 50 threads doing I/O )
let id =
Thread.create
(fun () ->
for j = 1 to 100 do ( read the file 100 times *)
let ch = open_in "q.data" in
let u =
let s = String.create n in
ignore(input ch s 0 5);
String.sub s 0 5
in
close_in ch;
if u <> "abcd\n" then
let v =
Printf.sprintf "i=%d j=%d s=%s\n" i j u in
prerr_endline v;
done;
)
()
in
l := id :: !l
done;
List.iter
(fun id ->
Thread.join id)
!l
;;
The text was updated successfully, but these errors were encountered: