I wrote code : ====================================== int main() { Stdio.File f=Stdio.File("lockfile","cr"); object l=f->lock(); write("I lock the file"); sleep(8); return -1; } ======================================= I run this program in two processes,one after anthoer, the second process would write "I lock the file" after 8 secconds the first process start to run. But if i wrote ======================================= int main() { Stdio.File f=Stdio.File("lockfile","cr"); object l=f->lock(); write("I lock the file");
return -1; } ======================================= and run in two processes, one after anthoer, the second process would write "I lock the file" immediately after it started.
I want to know why this happens, and why "return -1" is not work in this situation. I always think if I write "return -1" in the main(), the process will not quit and the file lock in the process will not destroy