Skip to content
Snippets Groups Projects
  • Nat Goodspeed's avatar
    39e7b483
    DRTVWR-476: Make llcoro::logname() distinguish different threads. · 39e7b483
    Nat Goodspeed authored
    Actually, introduce static LLCoros::logname() and make the namespaced free
    function an alias for that.
    
    Because CoroData is a subclass of LLInstanceTracker with a key, every instance
    requires a distinct key. That conflicts with our "getName() returns empty
    string for default coroutine on thread" convention. Introduce a new CoroData
    constructor, specifically for the default coroutine on each thread, that
    initializes the getName() name to empty string while providing a distinct
    "mainN" key. Make get_CoroData() use that new constructor for its thread_local
    instance, passing an atomic<int> incremented each time we initialize one for a
    new thread.
    
    Then LLCoros::logname() returns either the getName() name or the key.
    39e7b483
    History
    DRTVWR-476: Make llcoro::logname() distinguish different threads.
    Nat Goodspeed authored
    Actually, introduce static LLCoros::logname() and make the namespaced free
    function an alias for that.
    
    Because CoroData is a subclass of LLInstanceTracker with a key, every instance
    requires a distinct key. That conflicts with our "getName() returns empty
    string for default coroutine on thread" convention. Introduce a new CoroData
    constructor, specifically for the default coroutine on each thread, that
    initializes the getName() name to empty string while providing a distinct
    "mainN" key. Make get_CoroData() use that new constructor for its thread_local
    instance, passing an atomic<int> incremented each time we initialize one for a
    new thread.
    
    Then LLCoros::logname() returns either the getName() name or the key.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.