Home > OS >  The tee redirection causes the child to block the main process
The tee redirection causes the child to block the main process

Time:10-07

Program main_process (main process) after finish their tasks, you need to remove a large number of temporary files, very time consuming, so use a child process to do in the background, directly executable program there is no problem, after the main process, quickly the child to continue to delete files,
The user] $main_process
The log...
The user] $
And the main process in the implementation will produce a large number of log, in order to put the log is redirected to the file, add the tee,
The user] $main_process | & amp; The tee 1. The log
The log...
At this time will wait until after the child to delete all files, the master will withdraw from,

Delete files in the process of Lord tried two ways, 1. The system (CMD), and of course the system internal and fork the child process to do it, 2. Manual fork the child process to delete the file (use execv, remove, etc.),
After these two approaches in the tee has this problem, could you tell me what reason, how to solve?
  • Related