[MLton] Re: [MLton-user] FFI and pointer relocation

Wesley W. Terpstra wesley at terpstra.ca
Wed Nov 28 10:09:00 PST 2007


On Nov 28, 2007, at 6:22 PM, Matthew Fluet wrote:
> So, the best pattern would seem to be
>
> C_Time_t Time_sec;
> C_SUSeconds_t Time_usec;
> C_Int_t Time_getTimeOfDay(Ref(C_Time_t) sec, Ref(C_SUSeconds_t)  
> usec) {
>        struct timeval timeval;
>        int res;
>        res = gettimeofday (&timeval, (struct timezone*)NULL);
>        *((C_Time_t*)sec) = timeval.tv_sec;
>        *((C_SUSeconds_t*)usec) = timeval.tv_usec;
>        return res;
> }

That is indeed better. It's a nice start towards 'Once'ing the basis.  
Should the basis be a functor of Once, allowing single-threaded and  
multi-threaded versions? If it were, then "all" that would be left is  
a thread-safe garbage collector.




More information about the MLton mailing list