mirror of
https://gitlab.com/splashmapper/splash.git
synced 2026-06-16 12:33:50 +02:00
Fixed Python interpreted not respecting the update rate
This commit is contained in:
@@ -1281,7 +1281,7 @@ void PythonEmbedded::loop()
|
||||
lockAttributes.unlock();
|
||||
pythonMutexLock.unlock();
|
||||
|
||||
Timer::get() >> 1.f / static_cast<float>(_updateRate) * 1000.f >> timerName;
|
||||
Timer::get() >> 1000000ull / _updateRate >> timerName;
|
||||
}
|
||||
|
||||
pythonMutexLock.lock();
|
||||
|
||||
+3
-1
@@ -26,6 +26,7 @@
|
||||
#define SPLASH_TIMER_H
|
||||
|
||||
#include <chrono>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
@@ -115,7 +116,7 @@ class Timer
|
||||
*/
|
||||
bool waitUntilDuration(const std::string& name, unsigned long long duration)
|
||||
{
|
||||
std::lock_guard<Spinlock> lock(_timerMutex);
|
||||
std::unique_lock<Spinlock> lock(_timerMutex);
|
||||
if (!_enabled)
|
||||
return false;
|
||||
|
||||
@@ -144,6 +145,7 @@ class Timer
|
||||
_durationMap[name] = std::max(duration, elapsed);
|
||||
else
|
||||
durationIt->second = std::max(duration, elapsed);
|
||||
lock.unlock();
|
||||
|
||||
nanosleep(&nap, NULL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user