HELP: it works, but ...




	Hello one more time ;-)

	The program I'm coding works, but it has a little problem ...
( well, in fact it has a lot of them, but there is one very important ! )

THE PROGRAM
===========

	The program I am working in is x48 ( version 0.4.0 ). It is an 
emulator of the HP 48 calculator for Xwindow.
I'm trying to give it a better look with GTK ( the original version just 
uses xlib ! ), and, in a near future, to add new features.


THE PROBLEM
===========

	The original program has a principal routine that is like next:

/*** emulate function ***/
do {
     step_instruction();
     if( schedule_count-- == 0 )
	schedule();
} while( !end )
	

***********************************************************************

	And I've substituted it by:

/*** main program ***/
...
gtk_add( 0, (GtkFunction) emulate, NULL );
...
/*** end of main program ***/


/*** emulate function ***/
int emulate()
{
   step_instruction();
   if( schedule_count-- == 0 )
      schedule();

   return TRUE;
}


*********************************************************************

Well, it seems to work. After a lot of tests, I've found that to pass '0' 
as the interval in 'gtk_timeout_add' is the quickest way to speed up the 
execution of the emulation ...
But it is too slow for the normal running of the emulator ( 5 - 7 times 
slower ).

	
	I wonder if there is any other way to allow a function to execute 
to speed up it, instead 'gtk_timeout_add' that is to slow.
( the emulate function can't be optimized much more ).

Perhaps with pthreads? ( I have no idea about them ...)

	Well, can anyone help me, please?

	Thanks in advance:
 
                               INIGO SERNA

*************************************************************************
* INIGO SERNA ROBLEDO         *    E-mail:                              *
* Avda. de los Chopos 41, 2.C *               imaseroi@bi.ehu.es        *
* 48990. Getxo - BIZKAIA      *******************************************
*      BASQUE COUNTRY         * '... what made my dreams so hollow ...' *
*          SPAIN              *                               TOM WAITS *
*************************************************************************



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