Version française
Home     About     Download     Resources     Contact us    
Browse thread
[ANN] coThreads 0.10
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Zheng Li <li@p...>
Subject: Re: [ANN] coThreads 0.10

Hi,


Erik de Castro Lopo <mle+ocaml@mega-nerd.com> writes:
> skaller wrote:
>
>> 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".
>
> Ok.
>
>> 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).
>
> Shouldn't off_t always be 64 bits on a 64 bit CPU? I only see 
> this problem on x86-64 and Sys.word_size is 64.

Thank you for the bug report. 

Unfortunately I don't have a x64 machine to test, and know quite little about
64bit machine (that's why I made the mistake). 

But the bug reason seems obvious: on a x64 machine, one have to use
Unix.LargeFile.lseek to seek the address in the extra space. 

On the other hand, I think 2^14 locks (the x86 case) are fairly enough in
most situation. So we don't have to bother with Int64 and LargeFile. Could you
(or anyone else with a x64 machine) help to test the simple solution: change
"Sys.word_size - 2"  in the definition of "fresh_number" to 
"(min Sys.word_size 32) - 2" as follows

let fresh_number =
  let usable_size = (min Sys.word_size 32) -2 in
  let bits_of_id = 16 in (* Should be sufficient in most OS *)
  ........

and report whether it works? Thanks

-- 
Zheng Li
http://www.pps.jussieu.fr/~li