not enought timers

Posted on 2002-04-21
Last Modified: 2007-11-27
i have a server application which creates a (1) timer for every connection by a client...sometimes due to reasons i still haven't figured out a "not enough timer" message pops up whenever network probs when the network was cut or heavy...has anyone encountered this? thanks a lot! also, my server is a database server accessing SQL server so the load is kind of heavy when there are lots of clients connecting all at the same time to download data from the database

thanks in advance!

LVL 14

Expert Comment

ID: 6958976
There is a maximum number of timers that can be created. Therefore if you are really in need of a lot of timers, check out the RX Components, they have an RxTimerList component which can address your current problem.

Expert Comment

ID: 6959158
try avoiding timers and use GetTickCount instead.

make a startclock, stopclock mechanism..


startclock := getTickCount;
timer := 900;

while not (stopclock-startclock>=timer) do
  stopclock := getTickCount;

of course you want to have some sort of the timer's way of usage.. i'll make one if you want... i would design it so you have a Ttimer and it has a add(proc : Tporoc; interval : longint);
tProp = procedure(Sender:TObject);

and some other functions as remove_proc alter interval etc.

Accepted Solution

God_Ares earned 50 total points
ID: 6959367
This should work well enough.

unit Timer;


Uses classes,windows;


TProc = Procedure(Sender : TObject) of object;

TProcTimer = record
                fInterval : LongWord;
                fStartClock : LongWord;
                fActive : Boolean;
                fProc : TProc;

TProcTimers = array of TProcTimer;

TThreadTimer = Class(TThread)
                 FTimerData : TProcTimers;
                 FCaling : Integer;
                 Procedure Execute ; override;
                 Procedure ProcedureCaller;
                 Function Add(Proc : TProc; interval : LongWord) : Boolean;
                 Constructor Create;


Constructor TThreadTimer.Create;
  inherited Create(false);

Procedure TThreadTimer.Execute;
Var i:Integer;
Var StopTime,t : Longint;

  While Not Terminated Do
    StopTime := GetTickCount;
    For i:=0 to Length(FTimerData)-1 Do
      FCaling := i;
      If ftimerdata[i].fActive then
        t := (StopTime-ftimerdata[i].fStartClock);
        if (t >= ftimerdata[i].fInterval) then Synchronize(ProcedureCaller);
    Sleep(0);  //give procesor to other process.

Procedure TThreadTimer.ProcedureCaller;
var Call : Tproc;
  call := Ftimerdata[fcaling].fProc;
  Ftimerdata[fcaling].fStartClock := GetTickCount;

Function TThreadTimer.Add(Proc : TProc; interval : LongWord) : Boolean;
var b:Boolean;
  b:= 1=0;
    SetLength(FTimerData,Length(FTimerData)+1); //increase size.
    With FTimerData[Length(FTimerData)-1] Do
      fInterval := interval;
      fProc := Proc;
      fActive := 1=1;
      fStartClock := GetTickCount;
    b := 1=1;
  result := b;

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.


Expert Comment

ID: 6959470
plz modify sleep(0); to sleep(1);

Author Comment

ID: 6968001
whoa...god_ares that's kinda heavy stuff for me...can you please explain the code that you just did? sorry...


Expert Comment

ID: 6970963
well i create a new thread, and i hang in call's with will be called if their due..

it's kinda quick but im in a hurry just ask me what you want to know

Expert Comment

ID: 6975929
This question is reasonably current but needs your response.  ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if they are still open in 14 days.  Experts, please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.

To view your locked questions, please click the following link(s) and evaluate the proposed answer.

*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link 
POINTS FOR EXPERTS awaiting comments are listed in the link below
Moderators will finalize this question if in @14 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
Thanks everyone.
Moderator @ Experts Exchange

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
my delphi exe application have  problem with windows explorer ! 12 80
Newbie Thread Programming 1 139
Communication Between RC4 Delphi <-> PHP 3 101
Delphi - replicating a form 8 67
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now