hanging app..

  • Thread starter Thread starter JimmyHoffa
  • Start date Start date
J

JimmyHoffa

Hey All,

Hoping someone may be able to shine some light on my application.. I
have been writing a GPS based application that uses the code in the MS
WM6 SDK samples.

Problem I'm having is whenever I try and close the GPS, the device or
emulator hang.. leaving me with no choice but to reset.

The line it hangs on is

lock (this) {


Anyone any ideas what can be causing the problem ?

Thankyou..
 
Sounds like something else already owns the Monitor and the app is blocking
waiting on it. What else has locked on the this object (and BTW, locking on
"this" is generally a bad idea - create an object specific for locking on).
I would expect it to lock the app, but not the entire device, however.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 
Sounds like something else already owns the Monitor and the app is blocking
waiting on it.  What else has locked on the this object (and BTW, locking on
"this" is generally a bad idea - create an object specific for locking on).
I would expect it to lock the app, but not the entire device, however.

--

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












- Show quoted text -

Thanks.
 
As Chris says locking this is a bad idea in all cases.

Usually the pattern for this sort of thing is to create an object within
that instance to lock on, such as:

//declaration (class level)
object syncRoot = new object();

//method call
lock(syncRoot)
{
}

Usually this would reduce application locks.
 
Back
Top