Kaiepi/ra-Trait-Traced

Tracing is not thread-safe

Closed this issue · 0 comments

Tracing should never look like this!

bastille% raku -Ilib -MTrait::Traced -e 'sub foo is traced { bar }; sub bar is traced { 1 }; await (|do start for 1..5 { foo }, |do start for 1..5 { foo })'
    [CALL] (GLOBAL) sub bar
    --> 1
[CALL] (GLOBAL) sub foo
    --> 1
            [CALL] (GLOBAL) sub bar
            --> 1
            [CALL] (GLOBAL) sub bar
        --> 1
    [CALL] (GLOBAL) sub foo
    --> 1
    [CALL] (GLOBAL) sub foo
    --> 1
            [CALL] (GLOBAL) sub bar
            --> 1
            [CALL] (GLOBAL) sub bar
            --> 1
    [CALL] (GLOBAL) sub foo
    --> 1
    [CALL] (GLOBAL) sub foo
        --> 1
            [CALL] (GLOBAL) sub bar
            --> 1
        [CALL] (GLOBAL) sub bar
        --> 1
    [CALL] (GLOBAL) sub foo
    --> 1
[CALL] (GLOBAL) sub foo
        --> 1
    [CALL] (GLOBAL) sub bar
            --> 1
        [CALL] (GLOBAL) sub foo
        --> 1
        [CALL] (GLOBAL) sub bar
        --> 1
[CALL] (GLOBAL) sub foo
--> 1
    [CALL] (GLOBAL) sub bar
    --> 1
[CALL] (GLOBAL) sub foo
--> 1

This probably has to do with how Traced classes use $*TRACER.