A pulse can carry a 32 bit value. It can be a data with _Uint32t type,
isn’t it? How can I access to this value from that thread, which receives
the pulse?
I hope somebody can help me! Shall I get code examples, too?
// add this one also
pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
A pulse can carry a 32 bit value. It can be a data with _Uint32t type,
isn’t it? How can I access to this value from that thread, which receives
the pulse?
The pulse value and code can be acessed using:
int rcvid,chid,code,value;
union _msg{
struct _pulse pulseinfo;//stores data if a pulse.
char messagedata[80];//stores data if a message.
}msg;
struct _msg_info msginfo;
…setup stuff here… (ie open connection).
rcvid=MsgReceive(chid,&msg,sizeof(msg),&msginfo);
if(rcvid==0){//pulse
code=msg.pulseinfo.code;
value=msg.pulseinfo.value.sival_int; //msg.pulseinfo.value is actually a union of an int and pointer.
Now do stuff with code and value…
}
A pulse can carry a 32 bit value. It can be a data with _Uint32t type,
isn’t it? How can I access to this value from that thread, which receives
the pulse?
The pulse value and code can be acessed using:
int rcvid,chid,code,value;
union _msg{
struct _pulse pulseinfo;//stores data if a pulse.
char messagedata[80];//stores data if a message.
}msg;
struct _msg_info msginfo;
…setup stuff here… (ie open connection).
rcvid=MsgReceive(chid,&msg,sizeof(msg),&msginfo);
if(rcvid==0){//pulse
code=msg.pulseinfo.code;
value=msg.pulseinfo.value.sival_int; //msg.pulseinfo.value is actually a union of an int and pointer.
Now do stuff with code and value…
}