backgroundworker

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Wright

    #1

    backgroundworker

    I have a backgroundworke r thread that I need to check some data for me every
    6 hours or so. I can start the thread and do the check with great success,
    but I only need this thread to check every six hours. I tried the timer
    control, but that is clumbsy. I was wondering if I should use the thread to
    keep track of the system time and subtract the time from last check and when
    it hits 6 hours or greater run the process, or is there a better way? I
    really don't want this thread just processing time when it is not needed.
    Any suggestions?

    John Wright


  • Cor Ligthert [MVP]

    #2
    Re: backgroundworke r

    John,

    You mean that you want to use the instruction.

    threading.threa d.sleep(millise conds).

    As Spam Catcher already wrote. This is in my opinion a typical windowservice

    I hope this helps,

    Cor

    "John Wright" <riley_wright@n otmail.com> schreef in bericht
    news:epcl4hMZGH A.1220@TK2MSFTN GP02.phx.gbl...[color=blue]
    >I have a backgroundworke r thread that I need to check some data for me
    >every 6 hours or so. I can start the thread and do the check with great
    >success, but I only need this thread to check every six hours. I tried the
    >timer control, but that is clumbsy. I was wondering if I should use the
    >thread to keep track of the system time and subtract the time from last
    >check and when it hits 6 hours or greater run the process, or is there a
    >better way? I really don't want this thread just processing time when it
    >is not needed. Any suggestions?
    >
    > John Wright
    >[/color]


    Comment

    • John Wright

      #3
      Re: backgroundworke r

      I got it. I just set the sleep as shown below. Then recall the DoWork sub
      from the RunWorkerComple ted Sub. This gives me the six hours I need. A
      windows service would be more combersome as we don't want to install
      services on all the computers. This does great. Then I use delegates to
      interact with the program. Thanks for the help.

      John
      System.Threadin g.Thread.Sleep( System.TimeSpan .FromHours(6))





      "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
      news:%231TAKjRZ GHA.1192@TK2MSF TNGP04.phx.gbl. ..[color=blue]
      > John,
      >
      > You mean that you want to use the instruction.
      >
      > threading.threa d.sleep(millise conds).
      >
      > As Spam Catcher already wrote. This is in my opinion a typical
      > windowservice
      >
      > I hope this helps,
      >
      > Cor
      >
      > "John Wright" <riley_wright@n otmail.com> schreef in bericht
      > news:epcl4hMZGH A.1220@TK2MSFTN GP02.phx.gbl...[color=green]
      >>I have a backgroundworke r thread that I need to check some data for me
      >>every 6 hours or so. I can start the thread and do the check with great
      >>success, but I only need this thread to check every six hours. I tried
      >>the timer control, but that is clumbsy. I was wondering if I should use
      >>the thread to keep track of the system time and subtract the time from
      >>last check and when it hits 6 hours or greater run the process, or is
      >>there a better way? I really don't want this thread just processing time
      >>when it is not needed. Any suggestions?
      >>
      >> John Wright
      >>[/color]
      >
      >[/color]


      Comment

      Working...