系统相关
首页 > 系统相关> > linux shell 利用mkfifo解决高并发

linux shell 利用mkfifo解决高并发

作者:互联网

thread=5
tmp_fifofile=/temp/$$.fifo
mkfifo $tmp_fifofile
exec 8<>$tmp_fifofile
rm $tmp_fifofile

for i in `seq $thread`
do
    echo >&8
done

while :
do
 read -u 8
    {
     ....代码
   echo >&8
}& 
done
wait
exec 8>&-#释放文件

 

标签:tmp,do,shell,thread,mkfifo,fifofile,echo,linux
来源: https://www.cnblogs.com/chengfengchi/p/11312597.html