Re: How to handle long I/O operations



Taura,

You've been very helpful but I am still unclear as to how to handle the
work without threads in my case. I understood your job and timeout callback
example. In that example though, the I/O was assumed to be reading a
maximum stream of bytes, then possibly update a progress bar and end the
job if complete otherwise you would wait to continue the job on the next
timeout.

In my case, I don't have the coupling between the points the I/O are done
and the ability to update a progress bar.

Here is some additional background, I am working on the Enterprise Volume
Management System (EVMS) project (http://sf.net/projects/evms). We are
trying to develop something like a superset of Linux LVM. The architecture
provides an engine layer that allows creating partitions, volumes, volume
groups, etc. in memory from user space. At some point the frontends call
evms_commit_changes() to allow the engine to run through the queues and
commit changes to disk. Certain operations, such as moves or slides of
partitions or volumes may take a considerate amount of time to complete
(think of sliding 100GB of data in a partition over by just a couple of
sectors).

The evms_commit_changes() call that can be time and disk intensive is
currently synchrounous. In other words, it won't return until either an
error occurred in commit or the entire job of committing to disk is
complete.  So, while it does what it does, having a call to it in anything
that is called out by the main event loop would cause a freeze of the GUI.

I current have the evms_commit_changes() run in its own thread. The thread
gets passed a pointer a structure that will contain the return code and
status of the commit that can be monitored by the progress timeout function
to know when the timeout and progress bar updates are no longer needed.
This seems to work well and it keeps the event loop processing involving
the GUI updates separate from the commit work (which I would rather not
interrupt).

I've probably beat the issue to death but my sincere thanks to all that
responded.

regards,
Luciano Chavez



                                                                                                              
         
                    "Tara M"                                                                                  
         
                    <learfox furry ao net>         To:     "LIST: GTKAppDevel" <gtk-app-devel-list gnome org> 
         
                    Sent by:                       cc:                                                        
         
                    gtk-app-devel-list-admin       Subject:     Re: How to handle long I/O operations         
         
                    @gnome.org                                                                                
         
                                                                                                              
         
                                                                                                              
         
                    08/13/01 04:29 PM                                                                         
         
                    Please respond to "Tara                                                                   
         
                    M"                                                                                        
         
                                                                                                              
         
                                                                                                              
         




On Mon, 13 Aug 2001 11:31:58 -0500, Luciano Chavez said:

Taura,

 Thanks for all the suggestions. I did leave out one crucial bit of
 information on why fork() was not acceptable.

Don't worry, you don't need to fork() or thread anything, I really
think the solution is a lot simpler than you think. :)



--
--
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/



_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list







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