Qt-interest Archive, March 2002
Thread safe ??
Message 1 in thread
i think this question is asked again and again as i can see it in the list.
but i do not find a good way to come through
i have created a asynchronous function sig_func
that receives a SIGIO interrupt whenever there is
some data to be received on the socket.
i need to show a progress bar that displays the network speed quite like a
graphic equalizer ;0) .
I want to determine the speed of the network card over a period of time, but
as the signal function is not a member function so I have declared a global
pointer to progress bar.
but the prob is that after the data is recv and i do all the calculation if i
do something like globalpbar->setProgress(somevalue); in the catching
handler
then over a period of time it gives me segmentation fault ...
but if i remove the setProgress then it works fine ...
please can anyone suggest me where am i going wrong.
regards
Rohit
my interrupt codes goes like
void sigio_func(int i)
{
signal(SIGIO,SIG_IGN); // interrupt is locked now no more calls till the end
of the function
// all non blocking recv and socket code goes here
if((count%4)==0)
{
globalpbar->setProgress(bytes_rec);
//qApp->processEvents();
}
signal(SIGIO,sigio_func);
//qApp->processEvents();
}
--
[ signature omitted ]