[Mono-list] pthreads in mono
Chris Howie
cdhowie at gmail.com
Thu Mar 27 07:33:27 EDT 2008
On Thu, Mar 27, 2008 at 7:18 AM, Andreas Färber <andreas.faerber at web.de> wrote:
> You sure about that? Mono does use pthreads in some way, keeping it
> from running on BeOS.
>
> Is getting a pointer to the current thread in native land or using p/
> invoke not an option?
>
> Andreas
The whole point of those specific native functions is to run an
asynchronous loop on the specified thread, so getting a pointer to the
current pthread would not be useful. However, you may be able to get
a pointer to some other Thread object's pthread, but I would not be
too sure that this can be done from Mono directly.
You could use: [DllImport("pthread")] private static extern pthread_t
pthread_self();
However, you'd have to declare pthread_t somewhere, and this call
would have to be executed from the other thread -- meaning you'd have
to pass the return value over to the main thread and ... ugh. A
WaitHandle would undoubtedly be needed, and for what?
Writing a ThreadStart that infinitely loops over a call to gps_poll
sounds like a lot less work, no?
--
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers
More information about the Mono-list
mailing list