语言

Menu
Sites
Language
[CLOSED] Is device_power_request_lock reference-counted?

Meaning, if I call this device_power_request_lock 3 times, then I will need to call device_power_release_lock too? Or will a single device_power_release_lock automatically release the lock, no matter how many times I have called device_power_request_lock in the past?

Platform: Tizen 2.3.2, Gear S3.

Thank you.

编辑者为: James B 20 2月, 2017
查看选择的答案

响应

2 回复
Shaswati Saha

According to the documentation in this link, you should release the lock state each time as there're different enumeration for different lock type. Each enum ensures that the suitable device is on until all the lock requests have been released or after a timeout.

Also please note that, after the given timeout(ms), the given lock state is unlocked automatically. The second parameter of device_power_request_lock() function indicates the specified time after which the given lock state will be unlocked automatically. It takes positive number in milliseconds or 0 for permanent lock. 
So you must release the permanent lock of power state with device_power_release_lock() if timeout_ms is zero. 

Mark as answer
James B

Thank you Saha.

Unfortunately the documentation is not exactly very clear. Documentation says "shoud". "Should" is not the same as "must", and that's why I wonder what is the correct / strict behaviour.

I've done further test myself, and at least on my device and platform, I can confirm that it is NOT reference counted. Locking the power 3 times can be undone with a single unlock.