summaryrefslogtreecommitdiff
path: root/indra/llcommon/llthread.h
AgeCommit message (Collapse)Author
2021-05-17SL-15200: Add LLApp::sleep(duration) methods.Nat Goodspeed
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.
2020-03-25DRTVWR-494: Use std::thread::id for LLThread::currentID().Nat Goodspeed
LLThread::currentID() used to return a U32, a distinct unsigned value incremented by explicitly constructing LLThread or by calling LLThread:: registerThreadID() early in a thread launched by other means. The latter imposed an unobvious requirement on new code based on std::thread. Using std::thread::id instead delegates to the compiler/library the problem of distinguishing threads launched by any means. Change lots of explicit U32 declarations. Introduce LLThread::id_t typedef to avoid having to run around fixing uses again if we later revisit this decision. LLMutex, which stores an LLThread::id_t, wants a distinguished value meaning NO_THREAD, and had an enum with that name. But as std::thread::id promises that the default-constructed value is distinct from every valid value, NO_THREAD becomes unnecessary and goes away. Because LLMutex now stores LLThread::id_t instead of U32, make llmutex.h #include "llthread.h" instead of the other way around. This makes LLMutex an incomplete type within llthread.h, so move LLThread::lockData() and unlockData() to the .cpp file. Similarly, remove llrefcount.h's #include "llmutex.h" to break circularity; instead forward-declare LLMutex. It turns out that a number of source files assumed that #include "llthread.h" would get the definition for LLMutex. Sprinkle #include "llmutex.h" as needed. In the SAFE_SSL code in llcorehttp/httpcommon.cpp, there's an ssl_thread_id() callback that returns an unsigned long to the SSL library. When LLThread:: currentID() was U32, we could simply return that. But std::thread::id is very deliberately opaque, and can't be reinterpret_cast to unsigned long. Fortunately it can be hashed because std::hash is specialized with that type.
2020-03-25DRTVWR-494: Add on_main_thread(), sibling to assert_main_thread().Nat Goodspeed
2019-01-15SL-10291 Replace apr thread with standard C++11 functionalityandreykproductengine
2017-08-08MAINT-7634: Logging and instrumentation canges to narrow down viewer crashes.Rider Linden
2015-11-10remove execute permission from many files that should not have itOz Linden
2014-02-24merge with releaseRichard Linden
2013-12-10SH-4653 FIX Interesting: Viewer crashes while reading chat historyRichard Linden
2013-10-08merge from viewer-releaseRichard Linden
2013-10-04Merge. Pull in viewer-release after 3.6.7 release.Monty Brandenberg
2013-08-06SH-4411 Thread/mutex rework between main and worker threadMonty Brandenberg
Have the ::notifyLoadedMeshes() method doing correct locking and stall avoidance at the same time. This method now does lazy mutex lock acquisition (trylock()) and if it fails on either, it gives up and comes back later. Capture the maximum number of sequential failures and report this at the end of the run in the log. (So far, with big mesh regions, I've only seen 1s and 2s.) Locking/mutex requirements sorted in other locations as well. LLMutex gets trylock() method as well as new LLMutexTrylock scoped locking class. Clean up some documentation, more to do.
2013-07-22BUIDLFIX: moved LLThreadSafeRefCount to proper fileRichard Linden
2013-07-18SH-4297 WIP interesting: viewer-interesting starts loading cached scene lateRichard Linden
dependency cleanup - removed a lot of unecessary includes
2013-06-05merge with viewer-releaseRichard Linden
2013-05-09Merge downstream code and viewer-betasimon
2013-05-05Spring cleaning: removed unused .cpp and.h files, and cleaned up header ↵Richard Linden
dependencies
2013-04-26Convert LLThreadSafeRefCount back to atomic ref counting. Reviewed by Kellysimon
2013-04-23Revert LLThreadSafeRefCount optimization; caps fetching was failing. ↵simon
Reviewed by Kelly
2013-04-17Some minor cleanups while hunting crashes. Reviewed by Kellysimon
2013-03-29Update Mac and Windows breakpad builds to latestGraham Madarasz
2013-03-19Merge in viewer-beta to get CHUI codeSimon Linden
2013-03-01Make WL updates use pre-hashed strings for uniform setsGraham Madarasz (Graham)
2013-02-28Attempt at a faster ThreadSafeRefCount classGraham Madarasz (Graham)
2012-12-05SH-3406 WIP convert fast timers to lltrace systemRichard Linden
changed thread id declaration to be local to llthread.cpp and use currentID() uniformly across platforms
2012-11-20Pull and merge from ssh://hg@bitbucket.org/lindenlab/viewer-beta.William Todd Stinson
2012-11-20SH-3406 WIP convert fast timers to lltrace systemRichard Linden
fixes to merge
2012-11-19merge with viewer-developmentRichard Linden
2012-11-15SH-3406 WIP convert fast timers to lltrace systemRichard Linden
eliminated min and max macros from windows.h got rest of viewer to compile against llfasttimer changes
2012-10-17Pull and merge from ssh://stinson@hg.lindenlab.com/richard/viewer-chui/.William Todd Stinson
2012-10-03Fix for mac/linux buildDave Parks
2012-10-03Fix non-thread-safe refcounting of LLHTTPClient::Responder and fix ↵Dave Parks
out-of-order deletion of LLTextureFetch on shutdown
2012-10-01SH-3275 WIP Run viewer metrics for object update messagesRichard Linden
cleaned up API samplers are now value types with copy-on-write buffers under the hood removed coupling with LLThread
2012-09-28SH-3275 WIP Run viewer metrics for object update messagesRichard Linden
created separate constructor for static allocation of sampler buffer fixed start/stop/resume semantics of samplers and added sampler time interval tracking
2012-09-26SH-3275 WIP Run viewer metrics for object update messagesRichard Linden
slave threads now pushing data to master thread
2012-09-26SH-3275 WIP Run viewer metrics for object update messagesRichard Linden
fixed various issues related to unit tests and LLThreadLocalPtr initialization and teardown
2012-09-24fixed buildRichard Linden
moved LLThread::lockData and unlockData back to header
2012-09-24SH-3275 WIP Run viewer metrics for object update messagesRichard Linden
moved LLThreadLocalPtr to llapr fixed various startup race conditions for LLThreadLocalPtr
2012-09-21SH-3275 WIP Run viewer metrics for object update messagesRichard Linden
added LLThreadLocalPtr broke llmutex out into llmutex.h got primary sampling buffer under thread local storage
2012-11-07Merge. Refresh DRTVWR-209 with 3.4.2-beta1 code.Monty Brandenberg
Two fairly simple conflicts: dead stats sending code in the texture fetch code (new llcorehttp library) and the cleanup code in llappviewer was moved around in 3.4.x.
2012-06-14LLMutex recursive lock, global & per-request tracing, simple GET request, ↵Monty Brandenberg
LLProxy support, HttpOptions starting to work, HTTP resource waiting fixed. Non-LLThread-based threads need to do some registration or LLMutex locks taken out in these threads will not work as expected (SH-3154). We'll get a better solution later, this fixes some things for now. Tracing of operations now supported. Global and per-request (via HttpOptions) tracing levels of [0..3]. The 2 and 3 levels use libcurl's VERBOSE mode combined with CURLOPT_DEBUGFUNCTION to stream high levels of detail into the log. *Very* laggy but useful. Simple GET request supported (no Range: header). Really just a degenrate case of a ranged get but supplied an API anyway. Global option to use the LLProxy interface to setup CURL handles for either socks5 or http proxy usage. This isn't really the most encapsulated way to do this but a better solution will have to come later. The wantHeaders and tracing options are now supported in HttpOptions giving per-request controls. Big refactoring of the HTTP resource waiter in lltexturefetch. What I was doing before wasn't correct. Instead, I'm implementing the resource wait after the Semaphore model (though not using system semaphores). So instead of having a sequence like: SEND_HTTP_REQ -> WAIT_HTTP_RESOURCE -> SEND_HTTP_REQ, we now do WAIT_HTTP_RESOURCE -> WAIT_HTTP_RESOURCE2 (actual wait) -> SEND_HTTP_REQ. Works well but the prioritized filling of the corehttp library needs some performance work later.
2012-03-29CHUI-51 WIP notifications routig code cleanupRichard Linden
phase 2, removal of extraneous signaling in favor of llnotificationchannels made notificationchannels work better with overrides and lifetime managed by creator
2012-01-20fix for SH-2823 and SH-2824: LLCurl crash inside LLBufferArray::countAfter() ↵Xiaohong Bao
and LLBufferArray::copyIntoBuffers
2011-12-15fix for SH-2738 and SH-2777, might also help SH-2723: heap corruptionXiaohong Bao
SH-2738: Texture fetching freezes due to LLcurl SH-2777: viewer crashed on logout in LLCurl::Easy::releaseEasyHandle
2010-10-13correct licenses (fix problem with license change merge)Oz Linden
2010-06-14mergeDave Parks
2010-06-14EXT-7853: Made LLMutex destructor virtual.Lynx Linden
This fixes a potential resource leak whereby the destructor for LLCondition, which derives from LLMutex, is never called.
2010-03-21indra/llcommon/llthread.h : dos2unixTofu Linden
2009-12-18Fix for compiler errors introduced in merge.Dave Parks
2009-12-18Merge with viewer-2-0Dave Parks
2009-12-14Resolved timeout issues in mesh HTTP transfer.Dave Parks