50 CONDITION_VARIABLE
cv;
73 *
out = &
clock->IReferenceClock_iface;
101 TRACE(
"%p decreasing refcount to %lu.\n",
clock, refcount);
121 clock->cs.DebugInfo->Spare[0] = 0;
146 TRACE(
"Starting advise thread for clock %p.\n",
clock);
159 if (
sink->due_time <= current_time)
163 DWORD periods = ((current_time -
sink->due_time) /
sink->period) + 1;
165 sink->due_time += periods *
sink->period;
180 if (
clock->thread_stopped)
200 if (!(
sink = heap_alloc_zero(
sizeof(*
sink))))
225 return IUnknown_QueryInterface(
clock->outer_unk, iid,
out);
231 return IUnknown_AddRef(
clock->outer_unk);
237 return IUnknown_Release(
clock->outer_unk);
268 TRACE(
"clock %p, base %s, offset %s, event %#Ix, cookie %p.\n",
282 TRACE(
"clock %p, start %s, period %s, semaphore %#Ix, cookie %p.\n",
285 if (
start <= 0 || period <= 0)
333 if (!(
object = heap_alloc_zero(
sizeof(*
object))))
341 object->outer_unk =
outer ?
outer : &
object->IUnknown_inner;
342 object->refcount = 1;
345 object->cs.DebugInfo->Spare[0] = (
DWORD_PTR)(__FILE__
": SystemClockImpl.cs");
347 TRACE(
"Created system clock %p.\n",
object);
348 *
out = &
object->IUnknown_inner;
HRESULT WINAPI DECLSPEC_HOTPATCH SetThreadDescription(_In_ HANDLE hThread, _In_ PCWSTR lpThreadDescription)
static BOOL heap_free(void *mem)
#define InterlockedIncrement
#define InterlockedDecrement
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static void list_remove(struct list_entry *entry)
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
static void list_init(struct list_entry *head)
static ULONG WINAPI system_clock_inner_AddRef(IUnknown *iface)
static struct system_clock * impl_from_IReferenceClock(IReferenceClock *iface)
static const IUnknownVtbl system_clock_inner_vtbl
static HRESULT WINAPI SystemClockImpl_AdvisePeriodic(IReferenceClock *iface, REFERENCE_TIME start, REFERENCE_TIME period, HSEMAPHORE semaphore, DWORD_PTR *cookie)
static DWORD WINAPI SystemClockAdviseThread(void *param)
static LONG cookie_counter
static struct system_clock * impl_from_IUnknown(IUnknown *iface)
static ULONG WINAPI SystemClockImpl_AddRef(IReferenceClock *iface)
static HRESULT add_sink(struct system_clock *clock, DWORD_PTR handle, REFERENCE_TIME due_time, REFERENCE_TIME period, DWORD_PTR *cookie)
static HRESULT WINAPI SystemClockImpl_AdviseTime(IReferenceClock *iface, REFERENCE_TIME base, REFERENCE_TIME offset, HEVENT event, DWORD_PTR *cookie)
static HRESULT WINAPI system_clock_inner_QueryInterface(IUnknown *iface, REFIID iid, void **out)
static HRESULT WINAPI SystemClockImpl_Unadvise(IReferenceClock *iface, DWORD_PTR cookie)
static ULONG WINAPI system_clock_inner_Release(IUnknown *iface)
static HRESULT WINAPI SystemClockImpl_GetTime(IReferenceClock *iface, REFERENCE_TIME *time)
static REFERENCE_TIME get_current_time(void)
static ULONG WINAPI SystemClockImpl_Release(IReferenceClock *iface)
static HRESULT WINAPI SystemClockImpl_QueryInterface(IReferenceClock *iface, REFIID iid, void **out)
HRESULT system_clock_create(IUnknown *outer, IUnknown **out)
static const IReferenceClockVtbl SystemClock_vtbl
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
BOOL WINAPI SleepConditionVariableCS(PCONDITION_VARIABLE ConditionVariable, PCRITICAL_SECTION CriticalSection, DWORD Timeout)
BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection, IN DWORD dwSpinCount, IN DWORD flags)
VOID WINAPI WakeConditionVariable(PCONDITION_VARIABLE ConditionVariable)
_ACRTIMP clock_t __cdecl clock(void)
DWORD WINAPI timeGetTime(void)
GLsizei GLenum GLboolean sink
#define InterlockedCompareExchange
#define IsEqualGUID(rguid1, rguid2)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
static const char * debugstr_time(REFERENCE_TIME time)
IReferenceClock IReferenceClock_iface
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
#define CONTAINING_RECORD(address, type, field)
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
HANDLE WINAPI GetCurrentThread(void)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO