Hello,

We'd like to use threads in one of our Linux GTK Wx GUI's. The purpose of the thread is to check some text files for changes every 2 seconds. The changes need to be written back to a WxTextCtrl. I tried using Wx::MutexGUIEnter and Wx::MutexGuiLeave to block the main thread from execution while the GUI update is being made, but get the following error.

Error while autoloading 'Wx::MutexGuiEnter' at sqlplus_gui.pl line 594 thread 1

Do the Mutex functions not work in GTK?  I see the message on the Wx website.

"Note that under GTK, no creation of top-level windows is allowed in any thread but the main one."


Wx::MutexGuiEnter();
$shared_data->{textctrl}->AppendText('abc');
Wx::MutexGuiLeave();

If this doesn't work in GTK, what is the best approach for having a secondary thread relay the information back to the main thread for updating?

Or is using Wx::Timer a better approach?

Thanks,
Mike

Reply via email to