How to synchronize a kernel workqueue thread? -


i'm pretty new linux device drivers , kernel. want synchronize workque thread (lets call a()) function (lets call b()). purpose here fail b when running.

currently, have done follows.

a(){   active = true; // variable shared b/w both , b   ...   ...   ...   active = false; }  b(){    if(active){       return -ebusy     }  } 

is right way synchronize these 2 functions? there other strategy should follow?

for linux-kernel it's bad code. try reading mutex , semaphore.

http://www.linuxdevcenter.com/pub/a/linux/2007/05/24/semaphores-in-linux.html?page=5


Popular posts from this blog