Lazy implementation of C # timed tasks

Source: Internet
Author: User

There will usually be some work on timed tasks, such as counting the number of XXX users per minute or timing pulling down data.

It is common to implement scheduled scheduling functions and control whether threads can execute concurrently.

So usually a simple small project becomes a big project, but using Fluentscheduler will be much better

Project Link Https://github.com/fluentscheduler/FluentScheduler

For example I need a task run once per second if not run out next time do not perform:

                public static void Main (string[] args) {//console.writeline ("Hello world!"); Jobmanager.addjob (() = new Testservice (). xxxx (),                  (s) = S.nonreentrant (). Torunevery (1). Seconds ()); Console.ReadLine ();}            

Or I need a mission to run at 9 every day.

public static void Main (string[] args) {//console.writeline ("Hello world!"); Jobmanager.addjob (() = new Testservice (). xxxx (),                  (s) = S.nonreentrant (). Torunevery (1). Days (). at (9,0)); Console.ReadLine ();}

  

Lazy implementation of C # timed tasks

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.