Open william-p opened 11 years ago
Actually this limitation is due to the way the shared objects work.
In C there is no 'namespace' so every object (function) loaded by a module is "public". This means if you load the same module twice, there might be some conflicts.
As a workaround we could implement a list of AMQP servers handled by the neb.
We could use an ini file to store the differents credentials.
Ok, can't fix it.
The problem is not the absence of namespace.
In fact, we store many data in the global scope. It would be OK if we were just reading them. But we write to them.
In a multi-threaded context, the code, and the static data will be loaded once, every thread will share the same memory space for the code and the static data.
Since in C, all variables declared in the global space are stored in the static data space, there won't be any copy-on-write algorithm here.
Loading twice the broker will make the two threads write to the same shared data with no locking, or lock-free algorithm.
TL;DR: Variables in global scope are not easily thread-safe.
So this can be fixed with a better design in the source code. Unfortunately, there will be some time before refactoring.
Only one instance of Canopsis receive events.
conf:
log: