> > In my C program, I have two threads,
<snip>
> >   This I try fixing by putting a usleep in the while loop , hence there
> > is a small decrease in cpu utilization.
> 
> Create a pipe. Write data into that pipe from thd_r. In thd_w, you can
> do a blocking read on the pipe.

No, you don't want to do that, 
Passing data around pipes is expensive, you might as well busy spin in write 
thread. (yes there is always a splice syscall to do a zero copy op, but its 
complicated and not needed, all we need here is a conditional variable).

BAIN

_______________________________________
Pune GNU/Linux Users Group Mailing List 

Reply via email to