Author Topic: sending variables to a signal function  (Read 56 times)


  • Newbie
  • *
  • Posts: 25
  • Karma: +0/-0
    • View Profile
sending variables to a signal function
« on: November 17, 2017, 08:16:15 AM »
im trying to print on one process something that its on the shared memory so when i create a player in another process i send to the "Server" a signal and it supposed to print something like -Player "name" joined...
where name is something in the shared memory
so this function its executed when server recieve the signal
//Signal sended from other process "player.c"
//function in main "server.c"
void signal_new_player(int mysignal){
      printf("Player: \n");
and in main:
signal(SIGTERM, signal_new_player);
so i was wondering if is possible to make the function something like this:

void signal_new_player(int mysignal, player *shm){
      printf("Jugador: %d joined....\n", shm[0]);
i mean, send more parameters (char, int, arrays, pointers, etc) to the function that is executed when the signals arrive.

thanks in advice!!

For more details :  teaser trailer