Browse thread
[ANN] coThreads 0.10
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2007-09-18 (05:59) |
From: | skaller <skaller@u...> |
Subject: | Re: [Caml-list] [ANN] coThreads 0.10 |
On Tue, 2007-09-18 at 12:10 +1000, Erik de Castro Lopo wrote: > Zheng Li wrote: > > > > > Hi, > > > > I'd like to announce the first public release of coThreads, a > > concurrent programming library for OCaml. > > I've compiled this with Ocaml 3.09.1 on x86 Linux and x86-64 Linux. > > Looking at the example program ray_nocol.ml, it works correctly > on x86 Linux but fails on x86-64 [0]: > > # > ./ray_nocol.proc.opt 9 1024 1 ray_nocol.proc.opt.pgm > Fatal error: exception Unix.Unix_error(12, "lseek", "") > > I've also tried the non-opt version and the nath version. All fail > in the same way. > > The errno value of 12 means "Out of memory". I did a little debugging > but couldn't find anything obvious. But it isn't an errno value that is reported, it is the index of the variant that is 12, and that is "Invalid Argument". I think I found it: let fresh_number = let usable_size = Sys.word_size -2 in let bits_of_id = 16 in (* Should be sufficient in most OS *) let bits_of_num = usable_size - bits_of_id in let counter = ref 0 in fun () -> let self_id = id (self ()) in let id_part = bit_chop_to_n bits_of_id self_id in let num_part = counter := bit_chop_to_n bits_of_num (!counter + 1); !counter in (id_part lsl bits_of_num) + num_part produces: 1695112678495748100 which seems a little big for lseek on a zero size file .. My man page says: lseek - reposition read/write file offset RETURN VALUE Upon successful completion, lseek() returns the resulting offset location as measured in bytes from the beginning of the file. Otherwise, a value of (off_t)-1 is returned and errno is set to indicate the error. It is not clear that a seek to an invalid position in the file is going to succeed. It's also not clear to me that the seek argument isn't 32 bits (depends on complex ugly GNU macro hackery what type off_t is .. my Caml got built with the LARGE_FILE macro thing so it should be 64 bits). -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net