Thread and PhAB

Hi

I have a problem. In my application made with PhAB I make a Thread that continuously scan the serial port, when I receive the information I need to dislpay it in a text box. I put in the thread routine a statement PtSetResource, but when my thread do this my application crash and send me a Segmentation Fault.

My thread has no attributes, is this the problem?

Thanks

You might want to show us the code that calls PtSetResource(). Also, when you update widgets from multiple threads there is a routine you should bracket the call with. Lastly, have you isolated the exactly place that causes the crash, and is it PtSetResource()?

Photon’s functions are not thread-safe. Thus enclose the PtSetResource by PtEnter and PtLeave.

do like this:

int flags = PtEnter(0);
PtSetResource(…);
PtLeave(flags);

  • this is works ;)

or:

PtEnter(0);
PtSet…;
PtLeave(0);

Thanks.

The functions:

PtEnter(0);
PtSet…;
PtLeave(0);

Solves my problem

My sincere Thanks