Hello Reks,
An easy way to restore responsiveness to the user interface while a qsort is running would be to put ProcessSystemEvents() into the comparison function. In this way, every time the comparison function is called, the user interface would be able to process one event. However, this might call ProcessSystemEvents() too often and unnecessarily slow down your qsort. As such, you might add some code such that it is only called every 10 or 100 comparisons (depending on your system). A better solution that should give better UI responsiveness and faster qsort processing would be to use multiple threads. When the user initiates a qsort (by pressing a button on the UI), dim the button and possibly light an LED to let the user know that the sort is taking place
, then create another thread to perform the qsort. The CVI Multithreading functions are located under Library >> Utility >> Multithreading. We have a good introduction document available online at http://www.ni.com by searching for "+multithread +C" that is titled "General Information on Multithreading for C Programmers". Example multithreading programs are located under \samples\utility\Threading. The CVI function that you would most likely use is CmtScheduleThreadPoolFunctionAdv(). I mention the "Adv"anced function because you may want to give your qsort thread slightly higher thread priority so that it completes faster (Above Normal for example).
Jeremiah Cox
Applications Engineer
National Instruments
http://www.ni.com/ask