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 9046951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:46:58+00:00 2026-06-16T11:46:58+00:00

I am aware that in .NET there are three timer types (see Comparing the

  • 0

I am aware that in .NET there are three timer types (see Comparing the Timer Classes in the .NET Framework Class Library). I have chosen a threaded timer as the other types can drift if the main thread is busy, and I need this to be reliable.

The way this timer works in the control of the timer is put on another thread so it can always tick along with the work begin completed on the parent thread when it is not busy.

The issue with this timer in a console application is that while the timer is ticking along on another thread the main thread is not doing anything so the application closes.

I tried adding a while true loop, but then the main thread is too busy when the timer does go off.

  • 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-06-16T11:46:59+00:00Added an answer on June 16, 2026 at 11:46 am

    I would use a Barrier that waits until all threads are done. Since there is a main and a counting thread, I have 2 participants. So it will look something like this:

     Module Module1
            Dim x As New Threading.Thread(AddressOf tick)
            Dim y As New Threading.Barrier(2)
    
            Sub Main()
                x.IsBackground = True
                x.Start()
                y.SignalAndWait()
            End Sub
    
            Sub tick()
                Threading.Thread.Sleep(10000)
                y.SignalAndWait()
            End Sub
        End Module
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am aware that in .NET there are three timer types (see Comparing the
I have ASP.NET MVC 4 with an HttpModule. I am aware that module's Init
I am aware that you can probably build a lower version of .NET, but
Note that I'm aware of other yield in vb.net questions here on SO. I'm
I have inherited a conventional three tier web app with ASP.net 2.0 for the
are there any CLR implementations that have deterministic garbage collection? Nondeterministic pauses in the
WinForms, .NET 3.5 I have a ComboBox that needs to display a growing list
In this hypothetical scenario there is an ASP.NET 4 web application that simultaneously aggregates
In the following code I have two classes, one that runs in a separate
Now that .NET 4.5 and Visual Studio 2012 has RTM, is there a way

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.