| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Hi, I am a audio device driever engineer.=20 I use many EKern::Sleep() in codec kern extenstion for reduce codec pop noi= se.=20 But somebody say "It is very dangerous". I want know why it is sangerous and what is casuse by usging this function.= =20 thank you. Edited by: happypunk on 20-Aug-2008 13:18 |
|
#2
| |||
| |||
| Hi If the sleep is a blocking sleep, e.g. waits for a counter to expire, then = this can cause problems depending on the length of time you want to sleep. Do you mean NKern::Sleep(TUint32 aTime) ? Puts the current nanothread to sleep for the specified duration and it can = be called from Symbian OS threads. Mark Symbian |
|
#3
| |||
| |||
| oh, I mean NKern::Sleep().=20 Is not it dangerous? |
|
#4
| |||
| |||
| NKern::Sleep will block the current thread for a number of milliseconds acc= ording to the parameter you give. Other threads can still run, so it is often safe. Times when NKern::Sleep should not be used: 1) If you don't know what context the function is called in 2) If your driver is executing in DFC0, DFC1 or interrupt context DFC0 is a shared thread, so all drivers using DFC0 are also blocked (a <= 5ms sleep is probably fine, but long sleeps can cause side effects in other= drivers because their DFC runs too late) DFC1 is the timer thread, calling NKern::Sleep here will deadlock the syste= m In interrupt context, the system will crash Recommended context to use NKern::Sleep: 1) in the context of a user thread For example when handling a DoControl 2) in your device driver's private DFC thread. Private DFC threads, created with Kern: ynamicDfcQCreate (from 9.3) or Ker=n: fcQCreate (from 8.1b) are recommended because your device driver can ma=ke blocking calls with NKern::Sleep or fast mutex / fast semaphore without = affecting other drivers. PS: the very dangerous function is Kern::NanoWait, which is a spinning dela= y loop and should only be used for microsecond size delays. (it blocks all = lower priority threads in the system) |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.