how to access the gui by thread function?


In a photon application i got a thread which is controling a network connection. I want to write out this connection state into a widget at a dialog. If the thread calls PtSetResource() the the application crashes. I think it is because of missing thread safenes.

How could i write out the state instead?

Here is the actual method which failed:
PtMainLoop( );
// on press connect button, i start the connection thread

if( connection_state == changed)
PtSetResource(ABW_output_widget); // crashes the application

Look at PtEnter and PtLeave, or have the second thread signal the first thread that some stuff needs to be refreshed.

Thanks, i found the tutorial “Parallel Operations” right now.