How to restrict simultaneous multiple access to a common file
I need to run 10 fuctions in the background simultaneously. Each function will need to write its output several times to a common output file. How can i restrict the access so that only one functions may access and write to the file at a time (i.e. all the functions do not write to the common output file simultaneously). Also i need to run another function when all the previous 10 functions completes their jobs. How do i know whether the previous functions have completed their jobs? Please help. Thanks.