pthreads



Currently I am creating an application using CLIST which updates UNIX 
processes or displays the result of what is occuring to various UNIX 
processes.  The problem that I am having is a performance issue and am 
somewhat certain it is not a GTK issue but am sending it to the mailing 
list to see if any GTK people have dealt with this before since I am fairly 
new to 'event driven' programs and the fact that I am considering using 
pthreads.  Here is my situation:
The application I am writing (using GTK and C) is an event - driven 
program. This program waits in a 'wait for an event to occur' loop until 
the user pushes a button or something. Using pthreads in a sequential 
program, how do you get around the problem of getting the data you need for 
the next function and knowing when you have it?
The idea of what I am doing is the following in my callback routine
While (tasks != last task)
{
/* do something - get free memory of system. */
call slow_routine() /* performs 3 unix level commands */
/* update display with proceses data in CLIST */
}
The routine that contains the while loop seen above is in callback routine 
from an event that takes place when the user pushes a button or something. 
Do you still think threads are the way to go. Basically, it goes through 
different UNIX processes or tasks that I have stored and gets info on them 
individually. Any ideas ?
Matt
I am fairly ignorant with thread usage but it seems that it is only good on 
programs that are sequential or when there is a routine that is slow.
However, I need a particular routine to finish before I can update the 
display.  Initially I was sending my unix output to temporary files, 
parsing the file and getting the values back.  I am now using popen instead 
of fopen, which  does not  seem faster but I thought that it would be.







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]