Home > Net >  Novice [help] c # how to implement multiple periodic task?
Novice [help] c # how to implement multiple periodic task?

Time:01-27

I do a WPF application, for example, need to do three things:
A: and other communications equipment, cycle 5 s, once every 5 s to send and receive data,
B: data processing, 1 min cycle, per minute processing update data to a database,
C: other issues, such as interactive, to response at any time, needs to run continuously,

That I how to realize two different cycle timing of tasks, and to ensure continuous operation task timely processing?

I used to do, embedded in the embedded real-time operating system failure, or Linux in the RT each Task to build a Task, assignment priority,
Each Task is an infinite loop, and then set the cycle time with TaskDelay can,

But feel a little confused, after watching the c # with asynchronous programming, parallel, multithreading, also has the task, but don't know how to get to the specific implementation,
Ask for advice

CodePudding user response:

And your embedded code principle, building a Task, embedded inside equals c # to create a thread, each thread are independent do not affect each other. Look to the multithreaded tutorials, threads in c # is a thread, the Task is a thread pool

CodePudding user response:

Don't close to the, so we don't know where is your confusion?

Here is the same way,

=Task device communications Task. Run (()=& gt; {
You said that the cycle of
}, longtime scheduling)

Task to handle data=Task. Run (()=& gt; {
Or you say cycle
}, longtime scheduling)

As for the interaction? Trigger the book you tell you what, what, how interaction is how interaction,


I also not much said, you said the situation the ans you estimate the confusion, the more you'll do as above (I wrote above is the pseudo code, his first to understand the Task how to use, their implementation)

CodePudding user response:

Timer to perform

CodePudding user response:

Quartz.net create execution plan
  •  Tags:  
  • C#
  • Related