samedi 14 novembre 2020

Running Blocking Function in Background

I am trying to run a program that essentially runs forever. I need to start it with certain parameters that I load in so I am running it from within my c++ program. Say this is the program.

int main() {
   while(true) {
     // do something
   }
}

It compiles to a shared library object: forever.so.

If I do the following from c++ nothing happens.

int main() {
  system("forever.so &");
}

If I do the following my program blocks forever (as would be expected).

int main() {
  system("forever.so");
}

What am I doing wrong here?

I can provide the strace and other info.

To be clear. The issue is that if I check processes with

ps -a 

I do not see any of my processes. This is when the program is paused during a debug session so the processes should still be alive.

Aucun commentaire:

Enregistrer un commentaire