Doubt in dialog based threads in linux (UI threading) 
Author Message
 Doubt in dialog based threads in linux (UI threading)

i am having a doubt regarding thread programming with linux c++ and qt.

here is my problem..

i have created a window (dialog) with a QLineEdit
    a QPushButton (captioned as "Start") and
    a QPushButton (captioned as "Stop")..

my requirement is this..
1. when i click the Start button
i am starting a seperate thread that displays
numbers 1, 2, 3... in the QLineEditone by one
with a delay of 100 milliseconds... if this
count reached 1000, it is reset to 1... and
it loops infinitly..

2. when i click the Stop button
i want to stop the tread..

i achieved the first one by using
1. pthread_create,
2. a thread function and "this" as the argument
3. using a bool-flag-variable we can stop the loop
    inside the thread-function.
   (loop is used to display the counter in the editbox)

but what happened when i clicked the start button is
1. the thread got started
2. so the consicutive numbers got displayed in the editbox
3. but the Pushbutton got hanged-up...
    means i cant click the pushbutton..
    and not even close the entire window...
    but the thread is running...

i think the window-message-loop for that window got hanged-up
due to the contineous loop running inside the thread function.

normally this thing happens to windows, when their child
process becomes heavy...

and when i worked in VB i will use DoEvents to avoid this
and when i worked in VC++ i will use a
PeekMessage () ... TranslateMessage () .. block
in such situation
to make the window-message loop listen other events...

i am in need of such thigs using Qt..

please help me...

thanks

by
- R.Padmakumar



Sun, 06 Apr 2003 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Doubt in dialog based threads in linux (UI threading)

2. UI Thread from dialog based application

3. mfc ui thread from dialog based application

4. Starting a UI Thread from a UI Thread.

5. MFC UI Thread doesnt start when COM method called in multi-threaded MFC dialog App

6. A doubt about Threads in Free Threaded components

7. UI Thread better than Worker thread for speed?

8. Awakening the UI thread from another thread in a Windows Form application

9. worker thread to ui thread

10. Trouble opening a dialog window in a UI thread

11. Problem Closing UI thread dialog boxes from main app

12. Can't create and run a modeless dialog with UI thread

 

 
Powered by phpBB® Forum Software