OmniThreadLibrary forum
News: SMF - Just Installed!
 
*
Welcome, Guest. Please login or register. May 17, 2012, 06:17:54 PM


Login with username, password and session length


Pages: [1]   Go Down

Author Topic: Handling the timer's id.  (Read 115 times)

Unspoken

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • Email
Handling the timer's id.
« on: February 03, 2012, 04:58:05 AM »

Hi Primoz.

Just a thought about the Timer ID.

I am working on quite big project with other people. They are working on their part of code and I am working on mine. For example, I've created this logging mechanism which logs periodically data on HD.
They use my logger but they have no idea (and they shouldn't) that it is based on TimedTask with Timer ID = 1.
But some other guy someday might introduce new timed task and he can also set it up for Timer with ID = 1. Therefore he will replace my callback with his. My logging will stop working, it will not log some crucial data and I lose my job ;-)

It would be good to have something like this:

Code: [Select]
var
  TimerID: Cardinal;
begin
  TimerID := GetNewUniqueTimerID;
  FTask.SetTimer(TimerID, 2 * 1000, @TTimedTask.MyTask);
end;

or another overload

Code: [Select]
    function  SetTimer(interval_ms: cardinal; const timerMessage: TOmniMessageID; out NewTimerID: Cardinal): IOmniTaskControl; overload;


Just my two cents;)

Regards.
Logged

Primoz Gabrijelcic

  • Administrator
  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • Email
Re: Handling the timer's id.
« Reply #1 on: February 03, 2012, 05:14:10 AM »

I don't think I'll add that.

If you are making a framework that internally uses OTL, then just add Timer ID management to your framework.
Logged
Pages: [1]   Go Up
 
 

Powered by MySQL Powered by PHP Powered by SMF 2.0.2 | SMF © 2006-2009, Simple Machines LLC

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM