[Qt-interest] Multi-thread GUI app. using signal/slot

Gabriel M. Beddingfield gabrbedd at gmail.com
Sat Apr 24 21:36:38 CEST 2010


Hi Gino,

On Sat, 24 Apr 2010, Gino wrote:

> But I can't get pointer to sin_src in main().
> In the main thread I only have pointer to thread class, which calls method
> which instantiates the objects I need pointers to. I can't instantiate them
> outside of sc_main.

A few ideas come to mind:

* In systemc_thread, add a member function that will return
   return the pointer.

   plotter.set_context( simulation_sc.get_context() );

   ...or vice versa if you need.  Within your thread's
   implementation file, perhaps pass the value as a
   static global variable from sc_main() to your class.

* Use an 'extern' global variable to pass the pointer from
   sc_main() to main().

* Create some manner of thread-safe callback for your
   plotter class.  Pass the callback function to your
   sc_main (through systemc_thread object).

Also, FWIW, it doesn't make sense to try and update your 
graphics more then 24 times a second.  Trying to update more 
doesn't enhance the user's experience and just bogs your 
system down.

-gabriel






More information about the Qt-interest-old mailing list