thread and gc.fullCollect
Sean Kelly
sean at f4.ca
Thu Jan 11 19:40:15 PST 2007
Bradley Smith wrote:
> I don't know anyway to check this, but won't the garbage collection
> interrupt the sleeping thread? I would expect the std.c.time.sleep()
> call to be interrupted when the garbage collector stops all threads to
> operate. Is there anyway to check whether the sleep call was interrupted?
Yes. And it's actually easier than I thought. Here's the pertinent
quote from the Posix spec:
"If sleep() returns because the requested time has elapsed, the value
returned shall be 0. If sleep() returns due to delivery of a signal, the
return value shall be the "unslept" amount (the requested time minus the
time actually slept) in seconds."
I don't know how I missed this the last time I read the spec--this is an
issue I was aware of and wasn't sure how to solve efficiently. I'm
going to fix it in Tango right now :-p
Sean
More information about the Digitalmars-d-learn
mailing list