<p></p>
<p>Sent from my Sony Xperia™ smartphone<br>
On Dec 25, 2013 4:16 PM, "Pranay Srivastava" <<a href="mailto:pranjas@gmail.com">pranjas@gmail.com</a>> wrote:<br>
><br>
> Hi santosh<br>
><br>
> I hope you understand difference between semaphores and spin locks.<br>
></p>
<p>Ya I am completely aware of sleeping locks n spin locks <br>
> If however you are stuck a situation where you can afford being preempted then you can use sem/mutex. But i think your serialization requires that you use spin locks then best is to have a guarded variable with spin lock and release the lock before you schedule.<br>
></p>
<p>I just wanted to verify if it was possible n if yes considering preemption is disabled..<br>
> Even if you set the state preempt count would be increased when you acquire spin lock. so you Cant schedule or go to sleep after spin lock.<br>
></p>
<p>Since schedule_timout would make sure the task remains on the run queue and intended to be scheduled back after the specificed jeffies period. It was just out of curiosity anyway .Thanks !!!</p>
<p>> Regards<br>
><br>
> On Dec 25, 2013 3:36 PM, "SaNtosh kuLkarni" <<a href="mailto:santosh.yesoptus@gmail.com">santosh.yesoptus@gmail.com</a>> wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> I wanted to verify/clarify if using schedule_timeout after acquiring a spinlock is safe?. So basically you have a situation where you are working on a critical code and you acquire a spin lock and you end up using a schedule_timeout after say setting the current task to Interruptible state 'cause you are waiting for some user space code to fill in some buffer from which you want to read.<br>
>> So my doubt is simple, is it safe to acquire a spinlock and use schedule_timeout.<br>
>> I assume the task is put in the run queue and will "ALWAYS" be scheduled back after the specified delay in schedule_timeout.<br>
>><br>
>> -- <br>
>> Regards,<br>
>> Santosh<br>
>><br>
>> _______________________________________________<br>
>> Kernelnewbies mailing list<br>
>> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
>> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
>><br>
</p>