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

Re: How to handle long I/O operations



On 12 Aug 2001 21:47:33 -0500, Luciano Chavez said:

> Hello,
>  
>  I am wondering the best approach to coding for long operations occuring
>  during a signal callback. 
>  


Hi, what you described sounds similar to a common situation that
I've dealt with. I'm not sure if our design would be applicatable
to your situation, but it's a very simple approach.

We have a primary management function that handles all per ``cycle''
instances that's called by GTK+ timeout. This timeout function
is to a short interval and the function handles the following:

Whenever a callback function generates a `job', a new structure
is alloated to the job list, the members of this structure are
filled with the important data, ie the FILE pointer if you were
downloading a file for example.

However once the job structure is allocated and set up (ie
a file being opened), the callback returns immediatly and does
nothing else.

Then as GTK+ control returns to toplevel, our management timeout
callback function is called, it then handles the list of jobs
per `cycle'.

I hope the tip helps you, let me know if you need a more detailed
explaination. Because this approach is very fundimental and dosen't
require anything fancy other than using GTK+'s timeout callback.


-- 
--
Sincerely,		    ,"-_			 \|/
-Capt. Taura M. 	    ,	O=__			--X--
.__			     ,_JNMNNEO=_		 /|\
OMNOUMmnne.		     {OMMNNNEEEEOO=_
UOOOBIOOOEOMMn. 	      'LONMMMMNNEEEOOO=.__..,,..
UUOOEUUOOOOOOOObe	       '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
OOUUUIEEIOONNOIUbe.		   "7OMMMMNNNNNWWEEEEOOOOOO"   "'.
EEBNNMMMNWNWWEEIMMNe.		  __  7EMMMNNNNNWWWEEEEEEEOO.	  " .
NNMMMMWWWMMMWEINMMMNn		 "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._     .
		  http://furry.ao.net/~learfox/






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