Skip to content
Snippets Groups Projects
  • Nat Goodspeed's avatar
    d313d702
    SL-15200: Add LLApp::sleep(duration) methods. · d313d702
    Nat Goodspeed authored
    Two sleep() methods: one accepting F32Milliseconds, or in general any LLUnits
    time class; the other accepting any std::chrono::duration.
    
    The significant thing about each of these sleep() methods, as opposed to any
    freestanding sleep() function, is that it only sleeps until the app starts
    shutdown. Moreover, it returns true if it slept for the whole specified
    duration, false if it woke for app shutdown.
    
    This is accomplished by making LLApp::sStatus be an LLScalarCond<EAppStatus>
    instead of a plain EAppStatus enum, and by making setStatus() call set_all()
    each time the value changes. Then each new sleep() method can call
    wait_for_unequal(duration, APP_STATUS_RUNNING).
    
    Introducing llcond.h into llapp.h triggered an #include circularity because
    llthread.h #included llapp.h even though it didn't reference anything from it.
    Removed. This, in turn, necessitated adding #include "llapp.h" to several .cpp
    files that reference LLApp but had been depending on other header files to
    drag in llapp.h.
    d313d702
    History
    SL-15200: Add LLApp::sleep(duration) methods.
    Nat Goodspeed authored
    Two sleep() methods: one accepting F32Milliseconds, or in general any LLUnits
    time class; the other accepting any std::chrono::duration.
    
    The significant thing about each of these sleep() methods, as opposed to any
    freestanding sleep() function, is that it only sleeps until the app starts
    shutdown. Moreover, it returns true if it slept for the whole specified
    duration, false if it woke for app shutdown.
    
    This is accomplished by making LLApp::sStatus be an LLScalarCond<EAppStatus>
    instead of a plain EAppStatus enum, and by making setStatus() call set_all()
    each time the value changes. Then each new sleep() method can call
    wait_for_unequal(duration, APP_STATUS_RUNNING).
    
    Introducing llcond.h into llapp.h triggered an #include circularity because
    llthread.h #included llapp.h even though it didn't reference anything from it.
    Removed. This, in turn, necessitated adding #include "llapp.h" to several .cpp
    files that reference LLApp but had been depending on other header files to
    drag in llapp.h.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.