- Qt 6.7
- Qt Core
- C++ Classes
- QSystemSemaphore
- Qt 6.7.0 Reference Documentation

# Obsolete Members for QSystemSemaphore

The following members of class QSystemSemaphore are deprecated. They are provided to keep old source code working. We strongly advise against using them in new code.

## Public Functions

`(deprecated)` | QSystemSemaphore(const QString &key, int initialValue = 0, QSystemSemaphore::AccessMode mode = Open)
`(deprecated)` QString | key() const
`(deprecated)` void | setKey(const QString &key, int initialValue = 0, QSystemSemaphore::AccessMode mode = Open)

## Member Function Documentation

### QSystemSemaphore::QSystemSemaphore(const QString &key, int initialValue = 0, QSystemSemaphore::AccessMode mode = Open)

This function is deprecated. We strongly advise against using it in new code.

Requests a system semaphore identified by the legacy key key. This constructor does the same as:

     QSystemSemaphore(QSystemSemaphore::legacyNativeKey(key), initialValue, mode)

except that it stores the legacy native key to retrieve using key().

### QString QSystemSemaphore::key() const

This function is deprecated. We strongly advise against using it in new code.

Returns the legacy key assigned to this system semaphore. The key is the name by which the semaphore can be accessed from other processes.

See also setKey().

### void QSystemSemaphore::setKey(const QString &key, int initialValue = 0, QSystemSemaphore::AccessMode mode = Open)

This function is deprecated. We strongly advise against using it in new code.

This function works the same as the constructor. It reconstructs this QSystemSemaphore object. If the new key is different from the old key, calling this function is like calling the destructor of the semaphore with the old key, then calling the constructor to create a new semaphore with the new key. The initialValue and mode parameters are as defined for the constructor.

See also QSystemSemaphore() and key().