Subject | Re: DELAY OR WAIT |
---|---|
Author | Adam |
Post date | 2004-12-13T02:13:47Z |
>new entry is inserted/updated etc.. An SP could then check, if the
> In his case, he should simply use triggers, which get fired when a
condition is satisfied, and execute the desired action.
>is also the simply function Sleep(msecs) which could be coded into an
> Anyway, WaitForSingleObject can only be used with an object. There
UDF. However, I cannot see why someone would like to block one of the
servers threads until a special condition is met. Better return
control to the client as soon as possible.
>Triggers would probably be a better solution for him. I would be
> Regards, Alex
careful about using sleep, because from memory (please check this, I
may be wrong but we did encounter this before), sleep acts on every
thread of the program.
If that is the case, then no other thread in firebird would receive
CPU time, and the query it was waiting for would probably never
finish, or at best take an awful long time. WaitForSingleObject has a
timeout parameter, as well as only acting on the current thread. You
could just wait for the firebird process or something like that (which
will always timeout), and set the timeout to 1.5 seconds.
I agree it is risky to sleep in a UDF even if it does work. I can see
a couple of reasons why you would want it, but to me they would put
too much resource demand on the server, and could easily be
transferred to the client application to poll.