summaryrefslogtreecommitdiffstats
path: root/examples/thread/prodcons/prodcons.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/thread/prodcons/prodcons.cpp')
-rw-r--r--examples/thread/prodcons/prodcons.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/examples/thread/prodcons/prodcons.cpp b/examples/thread/prodcons/prodcons.cpp
index cea949940..30652ac72 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;
}