Hi Slava,

I had a look at pthreads on my way home from work. It's a really nasty 
api to FFI because all the types are opaque but must be created by the 
caller. I was just going to hardcode the type sizes but then I noticed 
they're different on each unix and also seem to differ between versions 
of libc.

I was thinking of having the vm supply a C call to return a struct of 
all the sizes:

struct pthread_size_info {
        int sizeof_pthread_mutex_t;
        int sizeof_pthread_mutexattr_t;
        ....
        

        pthread_sizes_t()
                : sizeof_pthread_mutex_t(sizeof(pthread_mutex_t)),
                  sizeof_pthread_mutexattr_t(sizeof(pthread_mutexattr_t)),
                  ....
        {}
};

extern "C" const pthread_sizes_info *pthread_sizes();

I'm aware that this is an ugly hack. Is there a better way?

Cheers,

Phil


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to