CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Different option for Thread.Sleep?

    I don't have access and I'm not willing to sign up.

    Can you SIMPLY attach the zipped file in your reply (use the Manage Attachments button)?

  2. #17
    Join Date
    May 2012
    Posts
    27

    Re: Different option for Thread.Sleep?

    Quote Originally Posted by Arjay View Post
    I don't have access and I'm not willing to sign up.

    Can you SIMPLY attach the zipped file in your reply (use the Manage Attachments button)?
    Wvs.zip

    Here you go, I really appreciate the help.

  3. #18
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Different option for Thread.Sleep?

    Modify the Code class...

    Code:
    class Data
    {
        public void Restart()
        {
            ThreadPool.QueueUserWorkItem(DoWork);
        }
    
        private void DoWork(object dataState)
        {
            Thread.Sleep(3000);
    
            Console.WriteLine("Started!");
        }
    }
    This will delay the Restart operation without blocking the main thread. Of course it probably doesn't do what you really need it to do.

    If not, then repost a more complete zipped solution where the sample code shows code that is a bit closer to what you really need.

  4. #19
    Join Date
    May 2012
    Posts
    27

    Re: Different option for Thread.Sleep?

    Quote Originally Posted by Arjay View Post
    Modify the Code class...

    Code:
    class Data
    {
        public void Restart()
        {
            ThreadPool.QueueUserWorkItem(DoWork);
        }
    
        private void DoWork(object dataState)
        {
            Thread.Sleep(3000);
    
            Console.WriteLine("Started!");
        }
    }
    This will delay the Restart operation without blocking the main thread. Of course it probably doesn't do what you really need it to do.

    If not, then repost a more complete zipped solution where the sample code shows code that is a bit closer to what you really need.
    Thanks! that worked just fine!

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured