Qt Threading

External: index
Internal: |- preamble -|- downloads -|- end -|

Preamble

2011-09-06: PGM_VERSION "0.0.4" Attempt to add a QProgressDialog. Not very successful ;=((. ALL attempts to create, show, increment the progress bar, or hide from INSIDE the thread FAILED with a mysterious runtime error... this seemed to occur in repaint()...

The only possibility was to create the QProgressDialog, and show, hide, etc on the main thread through manipulating global variables and update the QProgressBar using the timer. UGH! UGH! UGH!

But it worked fine this way ;=)) All this 'new' stuff can be turned off by un-defining ADD_PROGRESS_DIALOG...

2011-08-31: Modification of use of QThread::terminate() after testing in Linux failed. Now functions in Ubuntu, and WIN32. That is there is no 'delayed' exit even if the thread is still processing the 'user' function. Also reduced waste time to 10 seconds, and added a void * parameter to the 'test' function, so that say a structure can be passed to the thread function, transparent to the thread...

2011-08-30: First 'working' version. It has a do-nothing function that spins for 25 seconds. The problem was, that if you start this test, and then try to exit the application, the exit would wait until the 'user' function finished, thus badly delaying the application exit. The Qt QThread documentation has a 'terminate()' function, but puts some warnings about using this.

So I added two tests (a) had the thread been run, and (b) was the thread presently in the 'user' supplied function. Since this is an application exit situation, there should not be too much concern about stopping a thread abruptly. Now only if the thread has NOT finished the 'user' function, which could take an indeterminate amount of time do I use the powerful 'terminate()' ;=))

Now my application exits promptly in ALL cases...

2011-08-30: I wanted to know and understand more about the Qt QThread interface, so began this test application, to test and develop a 'threading' class and model... At this stage the application does NOTHING! But it also provides me with a sort of blank 'template' that I hope to use when I want to develop or test other things...


top

Downloads

Take care downloading and running executables from the web!

 These zips only contains the SOURCE files. Use the Nokia Qt SDK and Creator to compile the executable in any OS supported by Qt.

Date Zip Size MD5
2011/09/06 threading-0.0.4-src.zip 24,429 d4ca5194c83ef978880ef1fa97b205b3
 Older versions
2011/08/31 threading-0.0.3-src.zip 23,479 fae416717553631ccd7f164f1f5640c9
2011/08/30 threading-0.0.2-src.zip 21,275 587360939c78650f6c85072263872939
 Just a NON FUNCTIONAL blank TEMPLATE below
2011/08/30 threading-0.0.1-src.zip 19,834 e2aa3a393f92646c54e2d7f1c23140f8

 


top

EOP

checked by Tidy  Valid HTML 4.01 Transitional