diff options
Diffstat (limited to 'examples/corelib/threads/doc/src/waitconditions.qdoc')
-rw-r--r-- | examples/corelib/threads/doc/src/waitconditions.qdoc | 42 |
1 files changed, 9 insertions, 33 deletions
diff --git a/examples/corelib/threads/doc/src/waitconditions.qdoc b/examples/corelib/threads/doc/src/waitconditions.qdoc index cfac460345..d46442d079 100644 --- a/examples/corelib/threads/doc/src/waitconditions.qdoc +++ b/examples/corelib/threads/doc/src/waitconditions.qdoc @@ -1,39 +1,15 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \example threads/waitconditions - \title Wait Conditions Example - \brief Demonstrates multi-thread programming using Qt. + \examplecategory {Data Processing & I/O} + \title Producer and Consumer using Wait Conditions \ingroup qtconcurrent-mtexamples - \brief The Wait Conditions example shows how to use QWaitCondition and - QMutex to control access to a circular buffer shared by a - producer thread and a consumer thread. + \brief The Producer and Consumer using Wait Conditions example shows + how to use QWaitCondition and QMutex to control access to a circular + buffer shared by a producer thread and a consumer thread. The producer writes data to the buffer until it reaches the end of the buffer, at which point it restarts from the beginning, @@ -54,7 +30,7 @@ An alternative to using QWaitCondition and QMutex to solve the producer-consumer problem is to use QSemaphore. This is what the - \l{Semaphores Example} does. + \l{Producer and Consumer using Semaphores} example does. \section1 Global Variables @@ -133,7 +109,7 @@ thread is the only one that can do anything; the consumer is blocked waiting for the \c bufferNotEmpty condition to be signalled (\c numUsedBytes is 0). Once the producer has put one - byte in the buffer, \c numUsedBytes is \c BufferSize - 1 and the + byte in the buffer, \c numUsedBytes is strictly greater than 0, and the \c bufferNotEmpty condition is signalled. At that point, two things can happen: Either the consumer thread takes over and reads that byte, or the producer gets to produce a second byte. |