Fixed strict aliasing issue in __pthread_once and SetWaitableTimer.
This commit is contained in:
parent
a9fecb90c4
commit
c19fef417b
|
@ -198,8 +198,9 @@ int pthread_attr_setschedparam(pthread_attr_t *attr,
|
|||
int __pthread_once(pthread_once_t *once_control, void (*init_routine)(void))
|
||||
{
|
||||
static pthread_once_t the_once = PTHREAD_ONCE_INIT;
|
||||
LONG once_now = *(LONG *)&the_once;
|
||||
LONG once_now;
|
||||
|
||||
memcpy(&once_now,&the_once,sizeof(once_now));
|
||||
if (InterlockedCompareExchange((LONG*)once_control, once_now+1, once_now) == once_now)
|
||||
(*init_routine)();
|
||||
return 0;
|
||||
|
|
|
@ -147,7 +147,11 @@ BOOL WINAPI SetWaitableTimer( HANDLE handle, const LARGE_INTEGER *when, LONG per
|
|||
else
|
||||
{
|
||||
DWORD remainder;
|
||||
req->sec = DOSFS_FileTimeToUnixTime( (FILETIME *)&exp, &remainder );
|
||||
FILETIME ft;
|
||||
|
||||
ft.dwLowDateTime = exp.s.LowPart;
|
||||
ft.dwHighDateTime = exp.s.HighPart;
|
||||
req->sec = DOSFS_FileTimeToUnixTime( &ft, &remainder );
|
||||
req->usec = remainder / 10; /* convert from 100-ns to us units */
|
||||
}
|
||||
req->handle = handle;
|
||||
|
|
Loading…
Reference in New Issue