14#if QT_CONFIG(systemsemaphore)
18 BOOL windowsError = GetLastError();
19 if (windowsError == 0)
22 switch (windowsError) {
23 case ERROR_NO_SYSTEM_RESOURCES:
24 case ERROR_NOT_ENOUGH_MEMORY:
25 error = QSystemSemaphore::OutOfResources;
28 case ERROR_ACCESS_DENIED:
29 error = QSystemSemaphore::PermissionDenied;
35 error = QSystemSemaphore::UnknownError;
36#if defined QSYSTEMSEMAPHORE_DEBUG
42HANDLE QSystemSemaphoreWin32::handle(QSystemSemaphorePrivate *self, QSystemSemaphore::AccessMode)
50 semaphore = CreateSemaphore(0,
self->initialValue, MAXLONG,
51 reinterpret_cast<const wchar_t*
>(
self->nativeKey.nativeKey().
utf16()));
52 if (semaphore == NULL)
53 self->setWindowsErrorString(
"QSystemSemaphore::handle"_L1);
59void QSystemSemaphoreWin32::cleanHandle(QSystemSemaphorePrivate *)
61 if (semaphore && !CloseHandle(semaphore)) {
62#if defined QSYSTEMSEMAPHORE_DEBUG
63 qDebug(
"QSystemSemaphoreWin32::CloseHandle: sem failed");
69bool QSystemSemaphoreWin32::modifySemaphore(QSystemSemaphorePrivate *self,
int count)
71 if (
handle(self, QSystemSemaphore::Open) ==
nullptr)
75 if (0 == ReleaseSemaphore(semaphore,
count, 0)) {
76 self->setWindowsErrorString(
"QSystemSemaphore::modifySemaphore"_L1);
77#if defined QSYSTEMSEMAPHORE_DEBUG
78 qDebug(
"QSystemSemaphore::modifySemaphore ReleaseSemaphore failed");
83 if (WAIT_OBJECT_0 != WaitForSingleObjectEx(semaphore, INFINITE, FALSE)) {
84 self->setWindowsErrorString(
"QSystemSemaphore::modifySemaphore"_L1);
85#if defined QSYSTEMSEMAPHORE_DEBUG
86 qDebug(
"QSystemSemaphore::modifySemaphore WaitForSingleObject failed");
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
Q_DECL_COLD_FUNCTION Q_CORE_EXPORT QString qt_error_string(int errorCode=-1)
GLuint64 GLenum void * handle
GLenum GLenum GLsizei count