Problem:
Call/Initialize Poco code from inside a C library, using loader (3rd party C program, our code is in c++).
- The Program loads our library, our lib initializes Poco::Logger and uses AsyncChannel + FileChannel in the logger.
- Fork from this process.
- Run some threads in the child process.
- try to exit the child process, joining threads.
- The AsyncChannel's destructor blocks on close(), essentially polling Queue and sleeping.
- The _queue has 1 element always when the destructor for AsyncChannel is called, and I assume that is due to the way the parent process is running and forking.
Now the question: Is this a problem with gcc that Forking a process does not call the constructors and just duplicates the memory? I have tried calling _queue.clear() inside AsyncChannel::AsyncChannel() but no results...
Has anyone seen this problem before? any proposed solution?