Hi, I'm using TBB to port a game I have written in Java (for Android) to C++ (for iPhone). As the game is multithreaded in Java, I was looking for something looking like Java for concurrency and came accross TBB that provides all the paradigm I need to port my game, which is great.However, I'm struggling with a detail that I don't know how to work around.The design of the game is pretty straight forward:- An engine in C++, that I run in a dedicated thread,- The main thread in Objective-C rendering the world based on the core outputs.These 2 threads are supposed to "talk" via an atomic provided by the engine to the other thread, containing all the necessary info to render a frame.The fact is that I instantiate the engine somewhere in the renderer, assign it to a member variable and start it like this:
core = new GameCore(configuration, 0); tbb::tbb_thread *thread = new tbb::tbb_thread(*core);It starts and everything is ok.In the main thread (the renderer), I keep a reference on this object (core) to be able to get the atomic reference on screen updates, to be able to render the adequate frame.And this is where my problem lies, when I dump memory addresses of the member instance (core) and the instance getting executed in the thread, I have different values. It must be because the thread creation creates a new instance of the "core" object. However, I couldn't figure out how to get this new object address, or maybe i'm completely wrong and I missed something obvious.A workaround would be to have the "atomic" as a member variable of the renderer itself, passing a pointer to the renderer to the engine, and have the engine updating it, but I'd like to do it the other way around to stick to the Java design.Do you guys have any idea of how I can achieve this?Thanks,BQ.