Menu

use of Timer, any scheduling solution ?

Help
2001-02-27
2001-02-28
  • Dmitri ILinykh

    Dmitri ILinykh - 2001-02-27

    Hello,

    What's the best way how to schedule a certain procedure to happen in a certain period within an app which use CommonC++ threads? Say, I have to postpone some task which then will access some methods of a class derived from Thread. Now I see only that signals aren't very multiplatform.
    Thanks for any help.
    Dimitri

     
    • David Sugar

      David Sugar - 2001-02-27

      Common C++ does make use of and provide an implimentation for Suspend and Resume.  There is also a generic "timer" capability in a Common C++ thread, but the actual capability varies by implimentation.  I want to see about creating a more consistent and portable replacement for this...

      David

       
    • Dmitri ILinykh

      Dmitri ILinykh - 2001-02-28

      Ok, thank you David. I think I will answer myself.
      In my app I have conception of Task that have fulfill() method which returns success/failure. In case of failure I would like to repeat Task::fulfill() in a while (depending on a particular Task). I'm getting Task*'s from a separate thread (class derived from Thread) by means of a method gettask() which finally waits at Event object as Run() of this thread puts Task*'s in a queue and signals the Event. So the idea how to repeat a task in some period is to supply the task back to this thread object and make use of Event timeout for delaying tasks from immediate return by gettask() to the main app thread. This way I can solve lack of portable timers in CommonC++, but only because I don't need any particular time schedule in my app.
      Hopefully this could give some ideas.
      Dimitri

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.