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

  • Home
  • SEARCH
  • 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 8867595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:05:05+00:00 2026-06-14T17:05:05+00:00

I have a do/while like the following: do { //1.look for a report //2.either

  • 0

I have a do/while like the following:

do {

  //1.look for a report

  //2.either use interops to run an xl macro report or run a batch file report or run vbs file report

  //3.then sleep/pause program for 150seconds 

} while (look for next report to run)

This is all withing a Console application.

How do I create the 150 second pause/sleep ? Step 2 might involve running various processes and I’m slightly worried that simply using Thread.Sleep might be troublesome as it is not thread safe.


Should I somehow work this sort of code into the structure i.e. put steps 1 and 2 in the CallMeBack method?

static void Main(string[] args) {
    var t = new System.Timers.Timer(1000);
    t.Elapsed += (s, e) => CallMeBack();
    t.Start();

    Console.ReadLine();
}
public static void CallMeBack() {

    //1.look for a report
    //2.either use interops to run an xl macro report or run a batch file report or run vbs file report

    Console.WriteLine("Doing some consuming time work using sleep");
}

(the above is taken from HERE)

  • 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-14T17:05:10+00:00Added an answer on June 14, 2026 at 5:05 pm

    This works in millisecond, you can catch it in case it gets interrupted, but that usually does not happen.

    System.Threading.Thread.Sleep(150000);
    

    Edit:

    Another option is to use join if you simply want to wait till others are done or if you want to execute once every 150 seconds, your own answer would work. Make sure you know what you want before asking.

    If you want thread-safe pause use:

    task.Wait(150000);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have some text file which contain proxy ip . which look like following
I have a simple menu, something like the following: while(cmd != quit){ cin >>
I have something wich looks to me like race condition while logging to file
I have a makefile with something like the following targets: install: do a whole
I have the following <li> and I would like the whole li to behave
I have part of my script that goes like this: while read line do
I have one thread that is receiving data over a socket like this: while
I have PHP script works without problems, like this : while($row4 = mysql_fetch_array($result4)) {
I have a function creating entries via grid() like this: (replace while-loop with function,
I'd like my app to have different functionality depending on whether it launched while

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.