Erland Sommarskog to Anton Shepelev:
>>Is there a more granular way to ease a tight
>>polling loop in T-SQL than WAITFOR DEALAY? A de-
>>lay of 3.33 milliseconds being a tad too long for
>>my purposes, I seek a way to implement delays of
>>about half a millisecond or shorter. I do not
>>need the precision of real-time systems and will
>>accept any solution to prevent a fast WHILE 1=1
>>loop from hogging the CPU.
>
>I guess that you could write a CLR procedure for
>the task.
Thanks. No idea why it didn't occur to me. I have
written .NET assemblies for MSSQL before. If per-
formace testing shows a need for a shorter delay I
will definitely follow your advice.
Meanwhile, my loop switches to zero delay once it
finds work to do, and back to a 3.3 ms delay once
all work is done and in incoming queue is empty.
--
() ascii ribbon campaign - against html e-mail
/\
http://preview.tinyurl.com/qcy6mjc [archived]