Pulse between a thread an the main process

Hi,

Here is what I’m doing.

I create a pulse using pulse=PtAppCreatePulse(NULL,-1);
then I use PtAppAddInput(NULL,pulse,func,NULL); to attach a callback
to it.

Then I create a thread which does PtAppPulseTrigger(NULL,pulse);
when needed.

pulse is a global var.

Now each time my thread call PtAppPulseTrigger() I get a SIGSEGV,
the application crashes in _PtFindPulse().

Any idea ?

Regards.

jhroyer <nospam28@joher.com> wrote:

I create a pulse using pulse=PtAppCreatePulse(NULL,-1);
then I use PtAppAddInput(NULL,pulse,func,NULL); to attach a callback
to it.

Then I create a thread which does PtAppPulseTrigger(NULL,pulse);
when needed.

pulse is a global var.

Now each time my thread call PtAppPulseTrigger() I get a SIGSEGV,
the application crashes in _PtFindPulse().

Does your thread call PtEnter() before PtAppPulseTrigger()?


Wojtek Lerch (wojtek@qnx.com) QNX Software Systems Ltd.

It worx now with PtEnter/PtLeave , thanks a lot :slight_smile:


“Wojtek Lerch” <wojtek@qnx.com> wrote in message
news:9c1e6m$ggq$1@nntp.qnx.com

jhroyer <> nospam28@joher.com> > wrote:
I create a pulse using pulse=PtAppCreatePulse(NULL,-1);
then I use PtAppAddInput(NULL,pulse,func,NULL); to attach a callback
to it.

Then I create a thread which does PtAppPulseTrigger(NULL,pulse);
when needed.

pulse is a global var.

Now each time my thread call PtAppPulseTrigger() I get a SIGSEGV,
the application crashes in _PtFindPulse().

Does your thread call PtEnter() before PtAppPulseTrigger()?


Wojtek Lerch (> wojtek@qnx.com> ) QNX Software Systems Ltd.

jhr <nospam@nospam.com> wrote:

It worx now with PtEnter/PtLeave , thanks a lot > :slight_smile:

You’re welcome. :slight_smile:

BTW Instead of using PtAppPulseTrigger(), you could just look into the
sigevent structure generated by PtPulseArm(), and use a kernel function
like MsgDeliverEvent() or MsgSendPulse(). This requires a bit more
setup but lets you avoid being blocked inside PtEnter().


Wojtek Lerch (wojtek@qnx.com) QNX Software Systems Ltd.

Yes MsgDeliverEvent would be way better since I have to use
PtEnter/PtLeave now.

How can I get the rcvid it needs ?

I need to find out the rcvid of the channel where PtAppAddInput
adds its callback…

Regards.

Previously, Wojtek Lerch wrote in qdn.public.qnxrtp.photon:

jhr <> nospam@nospam.com> > wrote:
It worx now with PtEnter/PtLeave , thanks a lot > :slight_smile:

You’re welcome. > :slight_smile:

BTW Instead of using PtAppPulseTrigger(), you could just look into the
sigevent structure generated by PtPulseArm(), and use a kernel function
like MsgDeliverEvent() or MsgSendPulse(). This requires a bit more
setup but lets you avoid being blocked inside PtEnter().


Wojtek Lerch (> wojtek@qnx.com> ) QNX Software Systems Ltd.

jhroyer <nospam28@joher.com> wrote:

Yes MsgDeliverEvent would be way better since I have to use
PtEnter/PtLeave now.

How can I get the rcvid it needs ?

I need to find out the rcvid of the channel where PtAppAddInput
adds its callback…

I don’t think you can get a rcvid without sending to yourself…
MsgSendPulse() seems much easier:

struct sigevent sev;
PtPulseArm( NULL, phpulse, &sev ); // Do this once at startup

assert( sev.sigev_notify == SIGEV_PULSE );
MsgSendPulse( sev.sigev_coid, sev.sigev_priority, sev.sigev_code, sev.sigev_value.sival_int );

Previously, Wojtek Lerch wrote in qdn.public.qnxrtp.photon:
BTW Instead of using PtAppPulseTrigger(), you could just look into the
sigevent structure generated by PtPulseArm(), and use a kernel function
like MsgDeliverEvent() or MsgSendPulse(). This requires a bit more
setup but lets you avoid being blocked inside PtEnter().


Wojtek Lerch (wojtek@qnx.com) QNX Software Systems Ltd.