mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Run variations calculation in background
but there are still side effects and thus it crashes. Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
be6b50fce4
commit
a9ceecc2e3
6 changed files with 35 additions and 1 deletions
|
@ -1713,11 +1713,13 @@ char *intdup(int index)
|
|||
|
||||
QHash<int, double> factor_cache;
|
||||
|
||||
QMutex factorCacheLock;
|
||||
extern "C" double cache_value(int tissue, int timestep, enum inertgas inertgas)
|
||||
{
|
||||
int key = (timestep << 5) + (tissue << 1);
|
||||
if (inertgas == HE)
|
||||
++key;
|
||||
QMutexLocker locker(&factorCacheLock);
|
||||
return factor_cache.value(key);
|
||||
}
|
||||
|
||||
|
@ -1726,6 +1728,7 @@ extern "C" void cache_insert(int tissue, int timestep, enum inertgas inertgas, d
|
|||
int key = (timestep << 5) + (tissue << 1);
|
||||
if (inertgas == HE)
|
||||
++key;
|
||||
QMutexLocker locker(&factorCacheLock);
|
||||
factor_cache.insert(key, value);
|
||||
}
|
||||
|
||||
|
@ -1733,3 +1736,15 @@ extern "C" void print_qt_versions()
|
|||
{
|
||||
printf("%s\n", QStringLiteral("built with Qt Version %1, runtime from Qt Version %2").arg(QT_VERSION_STR).arg(qVersion()).toUtf8().data());
|
||||
}
|
||||
|
||||
QMutex planLock;
|
||||
|
||||
extern "C" void lock_planner()
|
||||
{
|
||||
planLock.lock();
|
||||
}
|
||||
|
||||
extern "C" void unlock_planner()
|
||||
{
|
||||
planLock.unlock();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue