Possible race (FiascoOC) signalling?

Daniel Waddington d.waddington at ...60...
Fri Jul 29 17:52:54 CEST 2011


Hi Norman,
Yes, eliminating the global static constructor for the pager solved the 
problem.

Daniel

On 07/29/2011 04:45 AM, Norman Feske wrote:
> Hi Daniel,
>
> I am not able to reproduce the problem using Genode's SVN head and
> Fiasco.OC (tested with both revisions 31 and 36). I get the following
> output:
>
>   int main(): --- create local services ---
>   int main(): --- start init ---
>   int main(): transferred 56 MB to init
>   int main(): --- init created, waiting for exit condition ---
>   [init ->  test-daniel] Starting ldso ...
>   [init ->  test-daniel] Starting application ... environ: 1058
>   [init ->  test-daniel] Test::Pager::Pager(): Pager constructed OK.
>   [init ->  test-daniel] Test-pager-2 example. ;-))
>   [init ->  test-daniel] Test::SharedMemory::SharedMemory(): About to
> start the pager.
>   [init ->  test-daniel] Test::SharedMemory::SharedMemory(): About to
> attach to vaddr (0x0)
>   [init ->  test-daniel] Test::SharedMemory::SharedMemory(): Attached
> dataspace to vaddr (0xfff000)
>   [init ->  test-daniel] shmem created ok.
>
> Looks ok to me. If in doubt about the construction time of the '_pager'
> object, I suggest constructing the object using a function with a local
> static variable:
>
>   Test::Pager *pager() {
>     static Test:Pager instance;
>     return&instance;
>   }
>
> This way, 'instance' is constructed at the first call of 'pager()'. So
> you have much better control over the time of construction. As a nice
> side effect, the execution order of constructors (if global objects
> depend on each other) becomes correct by definition. For this reason, we
> usually avoid the use of global constructors altogether.
>
> Regards
> Norman
>




More information about the users mailing list