How to share data between kernel tasks? (Game engine with kernel/kernel tasks)
<p>I have IKernelTask and derived classes of it (Making individual kernel tasks for input, sound ...) In addition I have CKernel which runs the different kernel tasks. CKernel has a function Execute() which runs through a list of the kernel tasks and runs their Update() function.</p>

<p>I am having difficulties when it comes to sending data between kernel tasks, so I decided to try sending data through the kernel by sending in a reference of the kernel object to Execute() and then to the kernel tasks the same way in Update().</p>

<p><strong>CKernel's Execute() is like so:</strong>  </p>

<pre><code>Execute(CKernel &amp;oKernel)  
For each kernel task:  
{  
    Update(oKernel);  
}  
</code></pre>

<p><strong>IKernelTask's Update() is like so:</strong>  </p>

<pre><code>Update(CKernel &amp;oKernel)  
{
    // Each kernel task has an overridden Update() function
}
</code></pre>

<p><strong>In Main:</strong>  </p>

<pre><code>while (running)  
{  
    oKernel.Execute(oKernel);  
}  
</code></pre>

<p>This would allow the kernel tasks to forward data between kernel tasks, by giving them access to the kernel through their Update() function.</p>

<p><strong>However:</strong><br>
1. Is this a good solution? If not, what would be a more conventional way to share data?<br>
2. If this is an ok solution; The problem is that CKernel needs to include IKernelTask and IKernelTask needs to include CKernel. I have tried forward declaration, but am getting errors such as: C2027: use of undefined type 'CKernel'</p>
