Fixed compilation of QSystemsemaphore for WinRT

As CreateSemaphore and WaitForSingleObject are
not supported on WinRT their supported alternatives
are used.

Change-Id: I1aa20076e286ed8ae28ba332bbed41ff8ce0feff
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
bb10
Kamil Trzcinski 2013-08-29 18:32:34 +02:00 committed by The Qt Project
parent d959c37eaa
commit 95e0da216f
1 changed files with 8 additions and 0 deletions

View File

@ -87,7 +87,11 @@ HANDLE QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode)
// Create it if it doesn't already exists.
if (semaphore == 0) {
#if defined(Q_OS_WINRT)
semaphore = CreateSemaphoreEx(0, initialValue, MAXLONG, (wchar_t*)fileName.utf16(), 0, SEMAPHORE_ALL_ACCESS);
#else
semaphore = CreateSemaphore(0, initialValue, MAXLONG, (wchar_t*)fileName.utf16());
#endif
if (semaphore == NULL)
setErrorString(QLatin1String("QSystemSemaphore::handle"));
}
@ -119,7 +123,11 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count)
return false;
}
} else {
#if defined(Q_OS_WINRT)
if (WAIT_OBJECT_0 != WaitForSingleObjectEx(semaphore, INFINITE, FALSE)) {
#else
if (WAIT_OBJECT_0 != WaitForSingleObject(semaphore, INFINITE)) {
#endif
setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore"));
#if defined QSYSTEMSEMAPHORE_DEBUG
qDebug() << QLatin1String("QSystemSemaphore::modifySemaphore WaitForSingleObject failed");