Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_corelib_thread_qreadwritelock.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
6
7void ReaderThread::run()
8{
9 ...
10 lock.lockForRead();
11 read_file();
12 lock.unlock();
13 ...
14}
15
16void WriterThread::run()
17{
18 ...
19 lock.lockForWrite();
20 write_file();
21 lock.unlock();
22 ...
23}
25
26
29
31{
32 QReadLocker locker(&lock);
33 ...
34 return data;
35}
37
38
41
43{
44 lock.lockForRead();
45 ...
46 lock.unlock();
47 return data;
48}
50
51
54
56{
57 QWriteLocker locker(&lock);
58 ...
59}
61
62
65
66void writeData(const QByteArray &data)
67{
68 lock.lockForWrite();
69 ...
70 lock.unlock();
71}
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
\inmodule QtCore
\inmodule QtCore
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
void writeData(const QByteArray &data)
QReadWriteLock lock
[0]
QByteArray readData()