Home > Back-end >  Chicken dishes for help
Chicken dishes for help

Time:09-27

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,

CodePudding user response:

reference 1st floor qybao 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,

The problem of meaning is to take an examination of smart Pointers on the one hand the

CodePudding user response:

reference 1st floor qybao 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,

If accumulation with static variables can also

CodePudding user response:

The life cycle of complex, all with smart Pointers!
You all know is going to take an examination of smart Pointers, have what problem?
 
STD: : from & lt; CFile> F=STD: : make_shared & lt; CFile> (a);
New SendTask (f);
New SendTask (f);
.
.
New SendTask (f);

All the end of the task, f nature is destroyed,

CodePudding user response:

reference 4 floor _mervyn response:
the life cycle of complex, net smart Pointers!
You all know is going to take an examination of smart Pointers, have what problem?
 
STD: : from & lt; CFile> F=STD: : make_shared & lt; CFile> (a);
New SendTask (f);
New SendTask (f);
.
.
New SendTask (f);

All the end of the task, f nature is destroyed,

Smart Pointers with too few bosses have any recommended books

CodePudding user response:


Reference counting,

CodePudding user response:

AddRef and Release, the Reference Counting

  • Related