how to make GUI a thread??

bridged with qdn.public.qnxrtp.photon
Post Reply
yiner

how to make GUI a thread??

Post by yiner » Tue Oct 14, 2003 1:25 am

Hi,
I am a newbie of photon.
I want to make my GUI a thread that can display my data of the process.
Who can help me and give me an example??
Thanks !!

Bill Caroselli

Re: how to make GUI a thread??

Post by Bill Caroselli » Tue Oct 14, 2003 12:44 pm

yiner <yinerchengmin@ipp.ac.cn> wrote:
y > Hi,
y > I am a newbie of photon.
y > I want to make my GUI a thread that can display my data of the process.
y > Who can help me and give me an example??
y > Thanks !!

My general philosophy is this: Don't let a UI program do any real work.
Have a server process that *does the work*. Develop an API for it.
Have your UI programs send messages to the server process to request
work be done and to get status information. Your server process can
have as many threads as are necesary.

BTW, in a real-time system the most important rule is this:
EVERY MESSAGE MUST BE REPLIED TO IMMEDIATELY!

Let me explain. Don't od this:
Client: Sends a request for an action that will take 30 seconds.
Server: Receives the message and performs the request.
Server: Replies to client.

In a real-time system this is an RBT (really bad thing).
Instead, do this:
Client: Sends a request for an action that will take 30 seconds.
The request should include a pulse that the server can send to when
done.
Server: Receives the message and immediately replies, "I understand.
I'll let you know how it goes." Or it may immediately reply with
"Your request is not valid for this reason" Either way, the server
should reply before it does any blocking operation.
Server: Dispatches a thread to do the work that will take 30 seconds.
When the request is done or fails,
Server: MsgSendPulse() back to client.
Client: Receives the pulse and sends a status request back to the server.
Server: Replies immediately with successful status or an error and reason.
(End of transaction)

This is just a good idea that has been working for me with QNX for
about 17 years. Some of the benefits are this:
1. it allows you to write multiple UI programs without having to
rewrite the work routines. Some of these UI programs may have a very
simple interface for some operators, while other UI programs may have
a much more complex interface for othr operators.
2. it allow you to have GUI programs and text UI programs.
3. it allows you to have your UI programs on a different host from the
server program.
4. it allow you to run multiple, concurrent UI programs. I.E you can
control a process from different places.

To implement #4 you should include a request that says, Pulse me on any
status change, even if someone else requested it. That way all screens
update automatically.

Post Reply

Return to “qdn.public.qnxrtp.photon”