How to wait for 2 events in 1 proxy ?

How to wait for two (or more) events in one proxy ?
How to determine from who/where the trigger was ?
/QNX 4.25

I’ve created one proxy:
qnx_proxy_attach( wait_pid, NULL, 0, -1 );

& 3 proxy triggers:
timer_create( CLOCK_REALTIME, &event1 );
timer_create( CLOCK_REALTIME, &event2 );
Trigger( wait_pid );

& waiting for triggers in Receive() loop:
for (;:wink: {
rcv_pid = Receive( 0, NULL, 0 );

How to get the trigger source (what event/process) ?

the rcv_pid will be equal the the value returned by qnx_proxy_attach (or qnx_proxy_rem_attach in case of remote use)

you cannot determine who triggered the proxy
in your example you have to create 3 different proxies to find out which one was the source of timer expiration or regural proxy trigger

PS: in your example you use

qnx_proxy_attach( wait_pid, NULL, 0, -1 ); Trigger( wait_pid );
I believe this is wrong approach, usually you should do:

proxy_pid = qnx_proxy_attach( 0, NULL, 0, -1 ); Trigger( proxy_pid ); proxy_pid_timer1 = qnx_proxy_attach( 0, NULL, 0, -1 ); event1.sigev_signo = -proxy_pid_timer1;

(However, if you are really trying to create a proxy which is targeted on another process then I cannot help you. I never tested the qnx_proxy_attach(other_pid, …) scenario, to me it just seemed quite useless in semantics of qnx4 messaging)

Code: yes, I didn’t paste all code, but it works.

In QNX 4.25 every thread is just another process (not like in QNX 6.x).
I’ve got main process & 2 threads (which are, in qnx 4, another processes).

Is there (in qnx 4) sth like qnx 6 pulse (pulse value + pulse code) ?
/I can’t use bloked-on-reply messages :frowning:

no, that code doesn’t work, it doesn’t make sense
unless you want to post actual code how the “threads/processes” are initialized, how proxies are created, how timers are created/armed and who triggers what…

there is not anything like qnx6 pulse in qnx4, as said before, i believe creating 3 different proxies is the only way

You can attach a value to a proxy under QNX4 however that value is assigned at creation time and cannot be changed. Hence as mezek suggest you must use more then one proxies.

Also a work of caution, threads under QNX4 can be very nasty.