summaryrefslogtreecommitdiffstats
path: root/examples/thread
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2025-07-01 22:09:14 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2025-07-08 09:01:42 +0900
commit81ade129093a279e6537db25710583fd2bba9427 (patch)
treea210834cbccc8aee2e9de7a8b7f41e1d31e2ced0 /examples/thread
parent35ced32e331ee29fda1642616c803637952f5b22 (diff)
downloadtqt-81ade129.tar.gz
tqt-81ade129.zip
Replace TRUE/FALSE with boolean values true/false - part 2
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> (cherry picked from commit c03a4800879ab62692e017e01c825ba12a421ad0)
Diffstat (limited to 'examples/thread')
-rw-r--r--examples/thread/prodcons/prodcons.cpp36
-rw-r--r--examples/thread/semaphores/main.cpp12
2 files changed, 24 insertions, 24 deletions
diff --git a/examples/thread/prodcons/prodcons.cpp b/examples/thread/prodcons/prodcons.cpp
index 23004dfd6..a018da751 100644
--- a/examples/thread/prodcons/prodcons.cpp
+++ b/examples/thread/prodcons/prodcons.cpp
@@ -58,7 +58,7 @@ private:
ProdThread::ProdThread(TQObject *r, TQMutex *m, TQWaitCondition *c)
- : receiver(r), mutex(m), condition(c), done(FALSE)
+ : receiver(r), mutex(m), condition(c), done(false)
{
}
@@ -66,15 +66,15 @@ ProdThread::ProdThread(TQObject *r, TQMutex *m, TQWaitCondition *c)
void ProdThread::stop()
{
mutex->lock();
- done = TRUE;
+ done = true;
mutex->unlock();
}
void ProdThread::run()
{
- bool stop = FALSE;
- done = FALSE;
+ bool stop = false;
+ done = false;
uchar *buffer = new uchar[BUFSIZE];
int pos = 0, oldpos = 0;
@@ -94,7 +94,7 @@ void ProdThread::run()
mutex->lock();
if (pos == BUFSIZE) {
- done = TRUE;
+ done = true;
}
while (! bytearray.isNull() && ! stop) {
@@ -159,7 +159,7 @@ private:
ConsThread::ConsThread(TQObject *r, TQMutex *m, TQWaitCondition *c)
- : receiver(r), mutex(m), condition(c), done(FALSE)
+ : receiver(r), mutex(m), condition(c), done(false)
{
}
@@ -167,15 +167,15 @@ ConsThread::ConsThread(TQObject *r, TQMutex *m, TQWaitCondition *c)
void ConsThread::stop()
{
mutex->lock();
- done = TRUE;
+ done = true;
mutex->unlock();
}
void ConsThread::run()
{
- bool stop = FALSE;
- done = FALSE;
+ bool stop = false;
+ done = false;
TQFile file("prodcons.out");
file.open(IO_WriteOnly);
@@ -251,17 +251,17 @@ private:
ProdCons::ProdCons()
: TQWidget(0, "producer consumer widget"),
- prod(0), cons(0), stopped(FALSE), redraw(TRUE)
+ prod(0), cons(0), stopped(false), redraw(true)
{
startbutton = new TQPushButton("&Start", this);
connect(startbutton, TQ_SIGNAL(clicked()), TQ_SLOT(go()));
stopbutton = new TQPushButton("S&top", this);
connect(stopbutton, TQ_SIGNAL(clicked()), TQ_SLOT(stop()));
- stopbutton->setEnabled(FALSE);
+ stopbutton->setEnabled(false);
loopcheckbox = new TQCheckBox("Loop", this);
- loopcheckbox->setChecked(FALSE);
+ loopcheckbox->setChecked(false);
prodbar = new TQProgressBar(BUFSIZE, this);
consbar = new TQProgressBar(BUFSIZE, this);
@@ -297,13 +297,13 @@ ProdCons::~ProdCons()
void ProdCons::go()
{
- stopped = FALSE;
+ stopped = false;
mutex.lock();
if ( redraw ) {
- startbutton->setEnabled(FALSE);
- stopbutton->setEnabled(TRUE);
+ startbutton->setEnabled(false);
+ stopbutton->setEnabled(true);
}
// start the consumer first
@@ -337,11 +337,11 @@ void ProdCons::stop()
if ( redraw ) {
// no point in repainting these buttons so many times is we are looping...
- startbutton->setEnabled(TRUE);
- stopbutton->setEnabled(FALSE);
+ startbutton->setEnabled(true);
+ stopbutton->setEnabled(false);
}
- stopped = TRUE;
+ stopped = true;
}
diff --git a/examples/thread/semaphores/main.cpp b/examples/thread/semaphores/main.cpp
index 913b75dc0..a56dce146 100644
--- a/examples/thread/semaphores/main.cpp
+++ b/examples/thread/semaphores/main.cpp
@@ -29,7 +29,7 @@ class YellowThread : public TQThread
{
public:
YellowThread(TQWidget *o)
- : receiver(o), stopped(FALSE)
+ : receiver(o), stopped(false)
{ ; }
void run();
@@ -57,7 +57,7 @@ void YellowThread::run()
mutex.lock();
if (stopped) {
- stopped = FALSE;
+ stopped = false;
mutex.unlock();
break;
}
@@ -76,7 +76,7 @@ void YellowThread::run()
void YellowThread::stop()
{
mutex.lock();
- stopped = TRUE;
+ stopped = true;
mutex.unlock();
}
@@ -85,7 +85,7 @@ class GreenThread: public TQThread
{
public:
GreenThread(TQWidget *o)
- : receiver(o), stopped( FALSE )
+ : receiver(o), stopped( false )
{ ; }
void run();
@@ -113,7 +113,7 @@ void GreenThread::run()
mutex.lock();
if (stopped) {
- stopped = FALSE;
+ stopped = false;
mutex.unlock();
break;
}
@@ -133,7 +133,7 @@ void GreenThread::run()
void GreenThread::stop()
{
mutex.lock();
- stopped = TRUE;
+ stopped = true;
mutex.unlock();
}