In some cases, a scheduler is needed to handle some work, such as network processing.ProgramWhen the received data is stored in the queue, the next receiving operation can be processed as quickly as possible. the received data information is processed by the debugger, such as data analysis and data packet processing. since the scheduler is responsible for processing the work, it is best to set a rule for the work to be processed, so as to facilitate the flexible expansion of processing in the future.
Rule setting Interface
?
12345 |
Public interface iworkitem: idisposable
{
void execute ();
}
|
In fact, the interface is very simple as an execute method, indicating to execute the job; so why do we need to implement idisposable? The purpose is to provide a release operation description for this job, when this task is completed, there will be a release action to deal with related matters.
Scheduler implementation
?
123456789101112131415161718192021222324252627282930313233343536373839 |