Scenario: a person send files to multiple people at the same time, make sure to send everyone after deleting files, but couldn't know who to finish after completion, the task of how to ensure the destructor in the file delete [each send a file is not a task, the server to send the file to multiple clients, to create the same task, but is not the same as the address, to finish the task is to destroy the file]
CodePudding user response:
Whether can consider to use a callback function, the callback function is invoked after the completion of each send tasks, the callback function is additive is called the number of times, until the called number and send the same number (prove all send task completion), can delete files,