[Haskell-cafe] Re: Issues with posix-realtime package

Manlio Perillo manlio_perillo at libero.it
Sat Jan 10 06:52:54 EST 2009


Galchin, Vasili ha scritto:
> Manlio,
> 
> so compiling to native machine code works ok but if using ghci byte-code 
> interpreter doesn't ..... can you supply your program please?
> 

Right.
Can't you reproduce the problem?

The program is very simple (I was just testing your package, since I 
suggested the use of clock_gettime to Mauricio in a previous post):

import System.Posix.Realtime.RTTime
import System.Posix.Realtime.RTDataTypes


main = do
   time <- clockGetTime Clock_Monotonic;
   print $ tvSec time
   print $ tvNsec time


runghc rttime.hs


I suspect that this is a problem with shared library loading in ghci, 
since the C code you use for your package, is also used by the base 
package (for the Posix subsystem).

By the way: I don't see reasons to add all that code, since it is not used.
However, when I tried to remove all the unused code, executing the 
program gave me a stack exception (maybe I have removed too many things...).



One personal note: I don't like `tvSec` and `tvNsec`, I think `seconds` 
and `nanoSeconds` is a better choice.

Also, it would useful a function to compute elapsed time (maybe a 
general class in base package, and a specialized instance declaration in 
posix-realtime for the timespec?)


> Vasili
> 

 > [...]



Manlio


More information about the Haskell-Cafe mailing list