I have a question about c++ pointer to function.
I have 3 modules in my architecture: Module A, Module B and Module C.
Modules B and C will be created by the module A.
Module B has the logic to decide when to put to stop all modules.
To do this, I thought that the module A can pass a pointer to a function to module B. In this function the module A will stop the module B,C and then himself. These modules have a pthread.
Do you think that this might be a good choice?
I followed these steps:
- I created a stop method on the form A;
- In module B, when I put it to stop all modules, I call the function passed as a pointer.
How do I to pass my function pointer in the constructor of the form B?