[android-developers] Re: timeout on wakelock causes WakeLock under-locked error

2010-07-07 Thread jdeslip
Ya, I am checking isHeld() before I release it when I do it
manually...  But, apparently when you set a timeout, whatever part of
android releases the wakelock does not check if it is held.  That is
my problem.  If I manually release it before the timeout, when the
timeout comes, I get an under-locked exception.

On Jul 7, 9:32 am, Mark Murphy mmur...@commonsware.com wrote:
 On Wed, Jul 7, 2010 at 12:26 PM, jdeslip jdes...@gmail.com wrote:
  Is there any way to use a timeout (as backup wakelock release in case
  the app force closes for some reason) without getting this error?

 Check isHeld() before release()-ing it.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 _Android Programming Tutorials_ Version 2.8 Available!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: timeout on wakelock causes WakeLock under-locked error

2010-07-07 Thread Mark Murphy
On Wed, Jul 7, 2010 at 1:39 PM, jdeslip jdes...@gmail.com wrote:
 Ya, I am checking isHeld() before I release it when I do it
 manually...  But, apparently when you set a timeout, whatever part of
 android releases the wakelock does not check if it is held.  That is
 my problem.  If I manually release it before the timeout, when the
 timeout comes, I get an under-locked exception.

Ah! Looking at the source code, you are correct. Seems like a bug to
me -- you might want to file this out on b.android.com.

That being said, I can think of no workaround, other than to avoid
manually releasing it.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 2.8 Available!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en