Unix threads and Sleep as a block process
Posted on 2003-11-18
Hi everyone ... thanks for taking your time to look at this ...
I am trying to create a process that creates a needed number of threads per single proces. Also, within this main process I have a 2 global vars that are accessed within threads as well as main process. Those 2 vars I am controling using the POSIX semaphores. I am shure that those semaphores are working and positioned right.
My problem is that I have to use the sleep within my main process to let those threads kick in to read / change the global vars. Since sleep blocks the entire process my program kind of run VERY slow.
My main loop looks like
create my thread etc etc
I was wondering if anyone is out there that is aware of any system call that would not block the entire process that I could use instead of sleep ....
Again ... thanks a loot for looking at this.