Hi Dan,
2008/7/23 Dan Hipschman dsh@linux.ucla.edu:
This isn't the most efficient implementation, but it works, and it should not be difficult to tweak. Hence, I'd rather get this version in and add the optimizations one at a time, in little patches. "Get it working first..."
Yes, I think you're right. I don't think it will be too hard to change the architecture of this to that of my suggestions.
However, I have one minor nit.
+static void WINAPI timer_queue_thread_proc(LPVOID p) +{
- struct timer_queue *q = p;
- ULONG timeout_ms;
- BOOL done;
- timeout_ms = INFINITE;
- while (!q->quit)
- {
LARGE_INTEGER timeout;
DWORD ret = NtWaitForSingleObject(q->event, FALSE,
get_nt_timeout(&timeout, timeout_ms));
This should be NTSTATUS.
if (ret == STATUS_TIMEOUT)
queue_timer_expire_next(q);
RtlEnterCriticalSection(&q->cs);
timeout_ms = timer_queue_update(q);
RtlLeaveCriticalSection(&q->cs);
- }
"Rob Shearman" robertshearman@gmail.com writes:
2008/7/23 Dan Hipschman dsh@linux.ucla.edu:
This isn't the most efficient implementation, but it works, and it should not be difficult to tweak. Hence, I'd rather get this version in and add the optimizations one at a time, in little patches. "Get it working first..."
Yes, I think you're right. I don't think it will be too hard to change the architecture of this to that of my suggestions.
Actually I think the code will be much simpler with a sorted timer list, so I'd suggest to start with that.