how to manage multible pulses?

Hi Community!!!

How is it possible to change the source code, that two or more pulses can be send.

Does anybody have a sample code for me with multible pulses without
using timers ???

Thank You !!!

---------------------------HEADER FILE---------------------------------
struct my_msg
short type;
char string[200]; /Message/
struct sigevent event;


/find server/
#define ATTACH_POINT “a”


#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/neutrino.h>
#include <sys/iomsg.h>
#include <sys/dispatch.h>

#include “my_hdr.h”
int main( int argc, char **argv)

struct my_msg msg;
struct _pulse pulse;

int rcvid,chid, coid, srv_coid,i;
name_attach_t *attach;
pid_t npid;


if(npid){ // SERVER

/* attach the name the client will use to find us /
our channel will be in the attach structure */
if ( (attach = name_attach( NULL, ATTACH_POINT, 0 )) == NULL)
printf(“SERVER: failed to attach name, errno %d\n”, errno );

/* wait for the message from the client */
rcvid = MsgReceive(attach->chid, &msg, sizeof( msg ), NULL );

printf(“DIE RCVID IST: %d\n”,rcvid);

if ( msg.type == MSG_GIVE_PULSE )
/* wait until it is time to notify the client */

/* deliver notification to client that client requested */
MsgDeliverEvent( rcvid, &msg.event );
printf(“SERVER: delivered event\n”);
printf(“SERVER : Der inhalt des PULSES war: %s\n”,msg.string);
} else
printf(“SERVER: unexpected message \n”);
return 0;

}else{ // CLIENT

strcpy(msg.string,"PULSE PULSE PULSE PULSE ");

for(i=0; i<2; i++){ //Dont works WHY ???

/* we need a channel to receive the pulse notification on */
chid = ChannelCreate( 0 );

/* and we need a connection to that channel for the pulse to be
delivered on */

/If flags contains _NTO_COF_CLOEXEC, the connection is closed
when your process calls an exec
() function to start a new process*/
coid = ConnectAttach( 0, 0, chid, _NTO_SIDE_CHANNEL, 0 );

/* fill in the event structure for a pulse (to send a pulse).*/
/SIGEV_PULSE_INIT( event, coid, priority, code, value )/

msg.type = MSG_GIVE_PULSE; /*“my_hdr.h” */

/* find the server */
if ( (srv_coid = name_open( ATTACH_POINT, 0 )) == -1)
printf(“CLIENT: failed to find server, errno %d\n”, errno );

/* give the pulse event we initialized above to the server for
later delivery */
MsgSend( srv_coid, &msg, sizeof(msg), NULL, 0 );

/* wait for the pulse from the server */
rcvid = MsgReceivePulse( chid, &pulse, sizeof( pulse ), NULL );

printf(“CLIENT: Receive Code %d waiting for %d \n”,
pulse.code, MY_PULSE_CODE );
return 0;

Just do two MessageDeliverEvent() in a row (although that’s odd looking)I’m not sure I understand what you are tyring to do here.

Thank You !!!

I just want to send two or more messages
from the Parent to the Child Process as a kind of
notification that something is ready

Thank You!!!

Since it’s a pulse before sending it, you could fill some part of the code field to indicate a specific state instead (like 2 item waiting on list) instead of sending two pulses.

Server can send as may pulse or messages as it wants. It’s the clients job to keep receiving that pulse in some kind of loop.