Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6888733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:03:52+00:00 2026-05-27T06:03:52+00:00

If is there 1 thread per Timer ? for example : class MyObj {

  • 0

If is there 1 thread per Timer ?

for example :

class MyObj
{
    private Timer _timer;

    public MyObj()
    {
        Initialize();
    }

    private void Initialize()
    {
        _timer = new Timer(2000);
        _timer.Elapsed += new ElapsedEventHandler(_timer_Elapsed);
        _timer.Start();
    }

    void _timer_Elapsed(object sender, ElapsedEventArgs e)
    {
        Console.WriteLine("MyObj !");
    }


}
class Program
{
    private static Timer _timer;

    private static void Main(string[] args)
    {
        _timer = new Timer(500);
        _timer.Elapsed += new ElapsedEventHandler(_timer_Elapsed);
        _timer.Start();
        MyObj mo = new MyObj();
        Console.Read();
    }

    static void _timer_Elapsed(object sender, ElapsedEventArgs e)
    {
        Console.WriteLine("Program !");
    }
}

Is there 2 threads ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:03:53+00:00Added an answer on May 27, 2026 at 6:03 am

    The timer uses the ThreadPool so at most you’d be using 2 threads. However, as threads in the ThreadPool are recycled it may end up using the same thread twice, or two threads but not simultaneously.

    The timer itself doesn’t cause the creation of a thread.

    Also, if your timer never ticks – it won’t post any work to the ThreadPool so in essence won’t “cost” you any threads.

    Be aware though that the tick thread is indeterminate… the thread you create the timer on is not the thread the tick will occur on. Any logic in your tick needs to be aware that it could be running in parallel with something else in the class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a thread-safe, non-blocking queue class in the C++? Probably a basic question
UPDATED: Is there a thread-safe, lock-free and available on all Linux distros increment function
There is a thread that fills the db and I am trying to make
[Note: There is another thread about this problem but it did not answer the
Is there an equivalent to Thread.Sleep() in Access VBA?
Is there a portable way of getting thread and/or process identifier (string, int, ...)
Is there any documentation on cross thread communication in Delphi? How can I send
Are there any concurrency problems with one thread reading from one index of an
Is there any way I can have a thread branch off into its own
I realize there is a somewhat related thread on this here: Loading assemblies and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.