Accessing a widget from a thread

I’m a novice in QNX Dev.

I use the PhAB and when I create a thread from the Window Create Event (A
thread used to read data from a socket port) I would like to display
received text in the ListBox used in my app (the Window contain the ListBox)
My Application is simple but I was believing that all vars were shared by
threads in the same process…
When I try to write the text in the list Box It crashes (but the writing
method is correct) …
Please let me know how to make accessible widgets in read/write from threads
or let me know where is my error…

(I’ve started QNX since 1 week and I’m very surprised by it’s power and
versatile purpose )
Thanks for all

Photon is not thread safe!
there are two possible ways to do that what you want to do.

  1. use PtAppAddWorkingProc to get called every time Photon is idle
  2. try to use PtEnter and PtLeave to lock access to the widgets
    go ahead and read about the above functions wihtin the Photon docs

“CALVET JC” <zefinder@yahoo.fr> schrieb im Newsbeitrag
news:a33nft$7u8$1@inn.qnx.com

I’m a novice in QNX Dev.

I use the PhAB and when I create a thread from the Window Create Event (A
thread used to read data from a socket port) I would like to display
received text in the ListBox used in my app (the Window contain the
ListBox)
My Application is simple but I was believing that all vars were shared by
threads in the same process…
When I try to write the text in the list Box It crashes (but the writing
method is correct) …
Please let me know how to make accessible widgets in read/write from
threads
or let me know where is my error…

(I’ve started QNX since 1 week and I’m very surprised by it’s power and
versatile purpose )
Thanks for all

\