Commit Graph

18 Commits (7b064920dbc1766a28279b72379b7f6383f88a4f)

Author SHA1 Message Date
clang-format-bot ddb0522bbf
Apply clang-format to code base 2 years ago
elsid fa1fb2a6b5
Reset mIsReleased before starting threads
To fix TSAN warning:

WARNING: ThreadSanitizer: data race (pid=68597)
  Write of size 1 at 0x7b3800079234 by main thread:
    #0 SceneUtil::WorkQueue::start(unsigned long) /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:51 (openmw+0x10daa10)
    #1 SceneUtil::WorkQueue::WorkQueue(unsigned long) /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:39 (openmw+0x10dad97)
    #2 OMW::Engine::prepareEngine(Settings::Manager&) /home/elsid/dev/openmw/apps/openmw/engine.cpp:700 (openmw+0xf7cb5a)
    #3 OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:949 (openmw+0xf82688)
    #4 runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:316 (openmw+0xf62611)
    #5 wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:205 (openmw+0x125df1c)
    #6 main /home/elsid/dev/openmw/apps/openmw/main.cpp:328 (openmw+0x596323)

  Previous read of size 1 at 0x7b3800079234 by thread T10 (mutexes: write M19275778865205896):
    #0 SceneUtil::WorkQueue::removeWorkItem() /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:86 (openmw+0x10d9e51)
    #1 SceneUtil::WorkThread::run() /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:127 (openmw+0x10da52a)
    #2 operator() /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:114 (openmw+0x10da664)
    #3 __invoke_impl<void, SceneUtil::WorkThread::WorkThread(SceneUtil::WorkQueue&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:61 (openmw+0x10da664)
    #4 __invoke<SceneUtil::WorkThread::WorkThread(SceneUtil::WorkQueue&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:96 (openmw+0x10da664)
    #5 _M_invoke<0> /usr/include/c++/11.1.0/bits/std_thread.h:253 (openmw+0x10da664)
    #6 operator() /usr/include/c++/11.1.0/bits/std_thread.h:260 (openmw+0x10da664)
    #7 _M_run /usr/include/c++/11.1.0/bits/std_thread.h:211 (openmw+0x10da664)
    #8 execute_native_thread_routine /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:82 (libstdc++.so.6+0xd33c3)

  Location is heap block of size 216 at 0x7b3800079220 allocated by main thread:
    #0 operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/tsan/tsan_new_delete.cpp:64 (libtsan.so.0+0x91824)
    #1 OMW::Engine::prepareEngine(Settings::Manager&) /home/elsid/dev/openmw/apps/openmw/engine.cpp:700 (openmw+0xf7cb4c)
    #2 OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:949 (openmw+0xf82688)
    #3 runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:316 (openmw+0xf62611)
    #4 wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:205 (openmw+0x125df1c)
    #5 main /home/elsid/dev/openmw/apps/openmw/main.cpp:328 (openmw+0x596323)

  Mutex M19275778865205896 is already destroyed.

  Thread T10 (tid=68609, running) created by main thread at:
    #0 pthread_create /build/gcc/src/gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:969 (libtsan.so.0+0x61c3a)
    #1 std:🧵:_M_start_thread(std::unique_ptr<std:🧵:_State, std::default_delete<std:🧵:_State> >, void (*)()) /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663 (libstdc++.so.6+0xd36aa)
    #2 std::_MakeUniq<SceneUtil::WorkThread>::__single_object std::make_unique<SceneUtil::WorkThread, SceneUtil::WorkQueue&>(SceneUtil::WorkQueue&) /usr/include/c++/11.1.0/bits/unique_ptr.h:962 (openmw+0x10da987)
    #3 SceneUtil::WorkQueue::start(unsigned long) /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:50 (openmw+0x10da987)
    #4 SceneUtil::WorkQueue::WorkQueue(unsigned long) /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:39 (openmw+0x10dad97)
    #5 OMW::Engine::prepareEngine(Settings::Manager&) /home/elsid/dev/openmw/apps/openmw/engine.cpp:700 (openmw+0xf7cb5a)
    #6 OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:949 (openmw+0xf82688)
    #7 runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:316 (openmw+0xf62611)
    #8 wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:205 (openmw+0x125df1c)
    #9 main /home/elsid/dev/openmw/apps/openmw/main.cpp:328 (openmw+0x596323)
3 years ago
elsid d4a2dab9d9
Remove redundant else 4 years ago
elsid eece47f70e
Avoid copying osg::ref_ptr when adding or removing item from work queue
Copy constructor does refcounting, and move constructor doesn't.
4 years ago
elsid f7a6be053d
Stop engine work queue before destructing environment
To avoid access to null and dangling pointers from active work items on
quitting.
4 years ago
elsid 3251687a3d
Use std types for WorkQueue 5 years ago
Andrei Kortunov e06f0b797a Replace all NULLs to nullptr 6 years ago
Andrei Kortunov 1452684d9e Use new logging system for components 6 years ago
scrawl 03554b2f4b Fix some style issues flagged by cppcheck 7 years ago
scrawl 29556a1802 More consistent wording of errors/warnings
A Warning indicates a potential problem in the content file(s) that the user told OpenMW to load. E.g. this might cause an object to not display at all or as intended, however the rest of the game will run fine.

An Error, however, is more likely to be a bug with the engine itself - it means that basic assumptions have been violated and the engine might not run correctly anymore.

The above mostly applies to errors/warnings during game-play; startup issues are handled differently: when a file is completely invalid/corrupted to the point that the engine can not start, that might cause messages that are worded as Error due to the severity of the issue but are not necessarily the engine's fault.

Hopefully, being a little more consistent here will alleviate confusion among users as to when a log message should be reported and to whom.
8 years ago
scrawl 8f79fa3d72 Add resource statistics panel opened with F4 8 years ago
scrawl 2f8be401cc Add the unref work items to the front of the workqueue (Bug #3273)
Ensures that memory still gets freed even if the workqueue is overloaded.
9 years ago
scrawl 90a99991d1 Use empty() instead of !size() 9 years ago
scrawl b7e69cbc64 Refactor WorkQueue, merge WorkTicket and WorkItem
Allow the caller to hold on to the WorkItem. This makes it possible for a derived WorkItem to store the result of the work within the WorkItem itself.
9 years ago
scrawl daa94cc50e Fix cppcheck warnings 9 years ago
scrawl b204396b57 Minor fix 10 years ago
scrawl 9c86d4f8bc Race condition fix 10 years ago
scrawl cc71e894e1 Add WorkQueue class 10 years ago