QNX RTOS v4 Knowledge Base
QNX RTOS v4 Knowledge Base
Title |
Timers and Send/Receive/Reply in PhAB |
Ref. No. |
QNX.000009787 |
Category(ies) |
Development |
Issue |
Our program makes use of many processes to handle different tasks. A couple of them call Receive() to get messages or timer events.
The process we want to add the timer widget to is separate from those other processes.
Adding timer caused some problems. We looked into documentation and found a comment that said "Do not Receive() with pid 0 in your application". Since our application spawns multiple processes, does this cause a problem? We do not Receive() in the process that the GUI is running in.
Does Receive() using 0 for the pid causes problems with another process that has a timer widget?
|
Solution |
Yes, it causes a problems. Here is the explanation:
Do not call Receive() with a process ID of 0 "anywhere else" in your application. In case you do, Photon events won't be processed properly and the user interface won't be updated.
In other words, do not call Receive() in a callback or GUI will be messed up. The only call to Receive() in the process handeling the GUI should be in the main loop. Add input handlers instead of calling Receive(). Other processes can call Receive().
So this is not what's causing a problem in your application.
Here are some hints when setting up your application:
- one process that handles the GUI(and has the PtTimer widget) should have input handlers for all messages sent by the other processes in your application.
- a number of other processes that Send() to the GUI process as required, do Send()/Receive()/Reply() among themselves. If the process handeling the GUI Send()'s to other processes, it will be blocked and Photon events won't proceed until other processes do the Reply().
|
|