[Mono-list] pthreads in mono

Chris Howie cdhowie at gmail.com
Thu Mar 27 01:04:45 EDT 2008


On Tue, Mar 25, 2008 at 9:42 AM, Jestin Stoffel
<jestin.stoffel at gmail.com> wrote:
> I am trying to write mono bindings to libgps, but I'm running into a
>  problem.  In libgps, there is a function to setup a callback that is
>  defined to take a pointer to a pthread, in addition to the usual
>  function pointer.  To delete the callback, the pointer to the pthread is
>  also required.  How do I create a pthread in mono so that I can send
>  this pointer to the library function?
>
>  --Jestin

I assume you are referring to gps_set_callback and gps_del_callback.
Since mono doesn't support pthreads as far as I know, it sounds like
you really want to use gps_set_raw_hook and gps_query/gps_poll to
trigger the callbacks.

You may already know this, but note that the delegate object you pass
to gps_set_raw_hook *must* have a reference held to it until the
unmanaged code is done with it, e.g. until you do gps_close.
Otherwise the GC may deallocate it.

-- 
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers


More information about the Mono-list mailing list