Re: Garbage collector is able to interrupt a native function?



No. The GC cannot interrupt the native call. The GC may run as soon as
executin returns across the P/Invoke boundary, so before your code gets any
return value, but the P/Invoke will run to completion.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com

"Frankie D." <FrankieD@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:29F91DA4-111A-4796-8539-B3B5F2F42ED2@xxxxxxxxxxxxxxxx
Hi,

There are two projects in my VS2005 solution: a managed and a native.
First
one written in C# is responsible for user interface, the second one
written
in C++ is responsible for real-time functionality.

They communicate each other using platform invoke. For example
MyCSharpFunc() calls MyNativeFunc().

MyNativeFunc() waits for a mutex, does some work and releases the mutex.
While this short work my real time thread is waiting for MyNativeFunc().

Garbage collector is able to interrupt MyNativeFunc()???
(Because MyNativeFunc() is called from a managed function)

Please help! Thanks in advance.

Frankie


.



Relevant Pages

  • Re: Adaptive mutexes
    ... > If we intialise a mutex in Solaris to a spin mutex, ... > initialised with the interrupt level to be disabled while the mutex is ... adaptive or spin mutex. ... spin then IPL is raised to the specified level for spin ...
    (comp.unix.solaris)
  • Re: esballoc() callbacks
    ... I'm wondering about soft interrupt issues and how the free ... You should create the mutex as any driver mutex using the driver's ... >other runs return buffers after a few minutes. ...
    (comp.unix.solaris)
  • Re: Suspending Threads
    ... the Interrupt method a) requires that you have a reference to the Thread object and b) causes an exception to occur in the thread. ... So while I agree that all three methods can accomplish essentially the same thing, I find that using Sleep/Interrupt is significantly inferior to the other two methods. ... For what it's worth, I also don't see mutex and event as being exactly equivalent, since the event is more a matter of signaling, while the mutex is an ongoing thing. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: scheduler (sched_4bsd) questions
    ... > Thread A holds a mutex x contested by Thread B and C and has priority ... > An interrupt thread I tries to lock mutex y owned by C. ... > However priority inheritance does not work since B needs to run first to ... if the interrupt happens after x is released then I's priority should ...
    (freebsd-arch)
  • Re: msleep(9) and recursed mutex
    ... When calling msleep, the ... > mtx mutex is still held which prevent the interrupt from happening. ... don't use recursive mutexes -- they are a necessary ...
    (freebsd-hackers)