Check to make sure all the system calls are thread-safe. QNX4 was never really designed with threading in mind and you may find that you will have to be careful to get it working at all.
There should be a box at the bottom of each call in the helpviewer which says whether the functions are signal/interrupt/thread safe.
Ok yeah I missed the qnx_scheduler, hence my comment about SCHED_FIFO doesnt apply. QNX4 doesnt support SMP
That being said, yes Rick there is a pthread library for QNX4. Was written by a QNX staffer, but never officially supported, obviously.
About the code, although the docs thats about using SCHED_FIFO to allow for some safety, it`s NOT a guaranty at all. I see in your code that you are using socket, TCP/IP is NOT thread safe. REally need to see the code on this one.
Unless you really really really have to, stay away from threads under QNX4.
Yes i am using QNX4 and socket, TCP/IP.
When i got rid of the loop in GetFrame() function( So, there was only one loop in GetFrameMain thread ), all were OK. But socket would be broken sometimes and GetFrameMain thread would be broken later.
What did happen to socket? And what can i do for this? Process? Or any other protections?
I think the answer is don’t use threads. Unless you are porting code, there is no reason to use threads to do anything in QNX4. There are some situation which are better solved by threads, but the workaround is a better solution given the issues with trying to thread in QNX 4.