Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Native threads under Debian 3.0r0
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-09-03 (23:00)
From: Berke Durak <berke@a...>
Subject: [Caml-list] Native threads under Debian 3.0r0
Hello everybody,

I'm having severe problems with native threads. Not only I can't get them to
work with the Graphics module, I can't get them to work at all. I'm
using a fresh Debian 3.0r0. I've recompiled Ocaml 3.06 with
'-with-pthread' option.  Shouldn't the following code

$ cat
open Thread

let _ =
  let code1 () =
	let x = ref 0 in
	while true do
	  incr x;
	  Printf.printf "alpha %d\n" !x;
	  flush stdout
  let thread1 = Thread.create code1 ()
  while true do

compiled with

$ ocamlopt.opt -thread unix.cmxa threads.cmxa -o toto

and run as

$ ./toto

give me something like

alpha 0
alpha 1
alpha 2
alpha 3
alpha 4
alpha 5
alpha 6


Instead, the program doesn't output anything, and when I hit Ctrl-C,
it leaves some processes running, which can only be killed with

The program works when compiled as bytecode. System info :

$ uname -a
Linux gogol 2.4.18 #1 Thu Aug 22 20:42:28 CEST 2002 i586 unknown
$ ls -l /lib/libpthread*
-rw-r--r--    1 root     root       102172 Apr 28 11:57 /lib/

However, even in bytecode, when I use the Graphics module, some subprocesses
refuse to die when I interrupt the main program.

Any clues ? Thanks very much.
Berke Durak
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: