//main
Scheduler::start(0, 2, emptyTask, true, false);
This is the head file for a function with a static function called start()
//scheduler.h
namespace fbr{
static FiberPool *fiberPool;
...
class Scheduler{
public:
static void start(const unsigned int FIBER_COUNT,
const unsigned int THREAD_COUNT,BaseTask* startingTask, bool
fibersAreDynamic, bool enableSleeping);
};
...
}
This is the class file and the code stops printing out when I try to intiallze the the static FiberPool pointer. The code hangs and doesn't execute the constructor. (con_cout is a custom version of std::cout)
//scheduler.cpp
void Scheduler::start(const unsigned int FIBER_COUNT, const unsigned int THREAD_COUNT,BaseTask* startingTask, bool fiberAreDynamic, bool enableSleeping){
...
con_cout << "scheduler before fbrpool!!" << fbr::endl; //this prints out
//construct FiberPool and its fibers
//if dynamic make sure there is at least 1 fiber per worker
if (useDynamicFibers && FIBER_COUNT < THREAD_COUNT){
con_cout << "before new fbrpool 1" << fbr::endl; //this prints out
fiberPool = new FiberPool(THREAD_COUNT); //code stops here for some reason when creating a new FiberPool within start (a static function)
}
...
}
This is FiberPool
namespace fbr{
public:
//constructor apparently is never called
FiberPool::FiberPool(const unsigned int FIBER_COUNT){
fbr::con_cout << "fiberpool!!" << fbr::endl;
for (unsigned int i = 0; i < FIBER_COUNT; i++)
fibers.push_back(new Fiber(i));
}
...
private:
//list of all the fibers available
con_vector<Fiber *> fibers;
}
This is the output:
//output
scheduler before fbrpool!!
before new fbrpool 1
Using Visual Studio 2013 on window 7. This compiles and runs perfectly if the code is all in one project. But when I have separate projects is the problem. Calling Scheduler::start(..) from my main in the second project makes this issue of compiling and then stopping execution.
I get no error messages with the debugger and windows doesn't try to end the process. My CPU in core 1 is always at maximum usage and at this point in the program there is only 1 thread (the main thread).
I have tried both static and dynamic linking but neither worked. With dynamic linking I had the linker set up and used Dynamic __declspec( dllexport ). I have references and additional include directories too. All the other code in my so called "library" work except this. Just to note I have not used the keyword friend.