[Mono-list] pthreads in mono

Paolo Molaro lupus at ximian.com
Fri Mar 28 08:10:09 EDT 2008


On 03/25/08 Jestin Stoffel 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?

The pointer is the one you got with gps_set_callback, so you can just
ignore the fact that it is a pthread_t pointer and all this thread that
went ballistic on that:

	[DllImport("gps")]
	static extern int gps_set_callback (IntPtr gps_data, GpsCallback cb, out IntPtr handler);

...

	IntPtr handler;
	IntPtr gps = gps_open ("localhost", "2947");
	gps_set_callback (gps, mycb, out handler);
	...

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better


More information about the Mono-list mailing list