i need have web page wait few seconds before doing something. let's "security" reasons can't use thread
class, can't call sleep
method (don't ask).
i mcgyvered solution:
datetime foo = datetime.now.addseconds(5); while (datetime.now < foo) { /*noop*/ }
it did work in console application, , in simple page did now. have half heart use lodged darkest corners of shadow self keeps telling me paving way own doom doing this. feel there catch it, can't tell is.
is safe use? sane?
try this:
mutex m = new mutex(); w.waitone(); m.waitone(timespan.fromseconds(5));
this hack of course. requirement not use thread.sleep
.
alternatively, call web service sleeps 5 seconds. way @ least don't burn cpu in busy loop.
Comments
Post a Comment