Merge branch 'dev' into patch-23
This commit is contained in:
commit
e1a6e74ab8
2
.gitignore
vendored
2
.gitignore
vendored
@ -7,6 +7,7 @@
|
|||||||
.directory
|
.directory
|
||||||
.vscode
|
.vscode
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
.idea
|
||||||
|
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
CMakeFiles
|
CMakeFiles
|
||||||
@ -44,4 +45,3 @@ clean
|
|||||||
*.tar
|
*.tar
|
||||||
*.xz
|
*.xz
|
||||||
*.zip
|
*.zip
|
||||||
|
|
||||||
|
@ -2732,8 +2732,8 @@ TP_RGBCURVES_BLUE;B
|
|||||||
TP_RGBCURVES_CHANNEL;Canal
|
TP_RGBCURVES_CHANNEL;Canal
|
||||||
TP_RGBCURVES_GREEN;V
|
TP_RGBCURVES_GREEN;V
|
||||||
TP_RGBCURVES_LABEL;Courbes RVB
|
TP_RGBCURVES_LABEL;Courbes RVB
|
||||||
TP_RGBCURVES_LUMAMODE;Mode Lominosité
|
TP_RGBCURVES_LUMAMODE;Mode Luminosité
|
||||||
TP_RGBCURVES_LUMAMODE_TOOLTIP;<b>Mode Lominosité</b> permet de faire varier la contribution des canaux R, V et B à la luminosité de l'image, sans altérer les couleurs de l'image.
|
TP_RGBCURVES_LUMAMODE_TOOLTIP;<b>Mode Luminosité</b> permet de faire varier la contribution des canaux R, V et B à la luminosité de l'image, sans altérer les couleurs de l'image.
|
||||||
TP_RGBCURVES_RED;R
|
TP_RGBCURVES_RED;R
|
||||||
TP_ROTATE_DEGREE;Degré
|
TP_ROTATE_DEGREE;Degré
|
||||||
TP_ROTATE_LABEL;Rotation
|
TP_ROTATE_LABEL;Rotation
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
|
|
||||||
//extern Glib::Threads::Thread* mainThread;
|
//extern Glib::Threads::Thread* mainThread;
|
||||||
|
|
||||||
bool FileBrowserEntry::iconsLoaded(false);
|
|
||||||
Glib::RefPtr<Gdk::Pixbuf> FileBrowserEntry::editedIcon;
|
Glib::RefPtr<Gdk::Pixbuf> FileBrowserEntry::editedIcon;
|
||||||
Glib::RefPtr<Gdk::Pixbuf> FileBrowserEntry::recentlySavedIcon;
|
Glib::RefPtr<Gdk::Pixbuf> FileBrowserEntry::recentlySavedIcon;
|
||||||
Glib::RefPtr<Gdk::Pixbuf> FileBrowserEntry::enqueuedIcon;
|
Glib::RefPtr<Gdk::Pixbuf> FileBrowserEntry::enqueuedIcon;
|
||||||
@ -58,15 +57,6 @@ FileBrowserEntry::FileBrowserEntry (Thumbnail* thm, const Glib::ustring& fname)
|
|||||||
|
|
||||||
scale = 1;
|
scale = 1;
|
||||||
|
|
||||||
if (!iconsLoaded) {
|
|
||||||
editedIcon = RTImage::createPixbufFromFile ("tick-small.png");
|
|
||||||
recentlySavedIcon = RTImage::createPixbufFromFile ("save-small.png");
|
|
||||||
enqueuedIcon = RTImage::createPixbufFromFile ("gears-small.png");
|
|
||||||
hdr = RTImage::createPixbufFromFile ("filetype-hdr.png");
|
|
||||||
ps = RTImage::createPixbufFromFile ("filetype-ps.png");
|
|
||||||
iconsLoaded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
thumbnail->addThumbnailListener (this);
|
thumbnail->addThumbnailListener (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,6 +80,15 @@ FileBrowserEntry::~FileBrowserEntry ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileBrowserEntry::init ()
|
||||||
|
{
|
||||||
|
editedIcon = RTImage::createPixbufFromFile ("tick-small.png");
|
||||||
|
recentlySavedIcon = RTImage::createPixbufFromFile ("save-small.png");
|
||||||
|
enqueuedIcon = RTImage::createPixbufFromFile ("gears-small.png");
|
||||||
|
hdr = RTImage::createPixbufFromFile ("filetype-hdr.png");
|
||||||
|
ps = RTImage::createPixbufFromFile ("filetype-ps.png");
|
||||||
|
}
|
||||||
|
|
||||||
void FileBrowserEntry::refreshThumbnailImage ()
|
void FileBrowserEntry::refreshThumbnailImage ()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -50,7 +50,6 @@ class FileBrowserEntry final : public ThumbBrowserEntryBase,
|
|||||||
{
|
{
|
||||||
|
|
||||||
double scale;
|
double scale;
|
||||||
static bool iconsLoaded;
|
|
||||||
bool wasInside;
|
bool wasInside;
|
||||||
ImageAreaToolListener* iatlistener;
|
ImageAreaToolListener* iatlistener;
|
||||||
int press_x, press_y, action_x, action_y;
|
int press_x, press_y, action_x, action_y;
|
||||||
@ -80,6 +79,7 @@ public:
|
|||||||
|
|
||||||
FileBrowserEntry (Thumbnail* thm, const Glib::ustring& fname);
|
FileBrowserEntry (Thumbnail* thm, const Glib::ustring& fname);
|
||||||
~FileBrowserEntry () override;
|
~FileBrowserEntry () override;
|
||||||
|
static void init ();
|
||||||
void draw (Cairo::RefPtr<Cairo::Context> cc) override;
|
void draw (Cairo::RefPtr<Cairo::Context> cc) override;
|
||||||
|
|
||||||
void setImageAreaToolListener (ImageAreaToolListener* l)
|
void setImageAreaToolListener (ImageAreaToolListener* l)
|
||||||
|
@ -82,59 +82,6 @@ void IdleRegister::destroy()
|
|||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
gboolean giveMeAGo(void* data) {
|
|
||||||
GThreadLock *threadMutex = static_cast<GThreadLock*>(data);
|
|
||||||
printf("A\n");
|
|
||||||
Glib::Threads::Mutex::Lock GUILock(threadMutex->GUI);
|
|
||||||
printf("B\n");
|
|
||||||
{
|
|
||||||
Glib::Threads::Mutex::Lock operationLock(threadMutex->operation);
|
|
||||||
printf("C\n");
|
|
||||||
|
|
||||||
threadMutex->operationCond.signal();
|
|
||||||
printf("D\n");
|
|
||||||
operationLock.release(); // because we're not sure that "lock" destructor happens here...
|
|
||||||
}
|
|
||||||
threadMutex->GUICond.wait(threadMutex->GUI);
|
|
||||||
printf("E\n");
|
|
||||||
|
|
||||||
GUILock.release();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GThreadLock::GThreadLock() : sameThread(false) {
|
|
||||||
if (Glib::Threads::Thread::self() == mainThread) {
|
|
||||||
sameThread = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("10\n");
|
|
||||||
{
|
|
||||||
Glib::Threads::Mutex::Lock operationLock(operation);
|
|
||||||
|
|
||||||
printf("20\n");
|
|
||||||
gdk_threads_add_idle(giveMeAGo, this);
|
|
||||||
|
|
||||||
printf("30\n");
|
|
||||||
operationCond.wait(operation);
|
|
||||||
printf("40\n");
|
|
||||||
operationLock.release();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GThreadLock::~GThreadLock() {
|
|
||||||
if (!sameThread) {
|
|
||||||
printf("50\n");
|
|
||||||
Glib::Threads::Mutex::Lock lock(GUI);
|
|
||||||
printf("60\n");
|
|
||||||
GUICond.signal();
|
|
||||||
printf("Fin\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
Glib::ustring escapeHtmlChars(const Glib::ustring &src)
|
Glib::ustring escapeHtmlChars(const Glib::ustring &src)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1197,7 +1197,7 @@ void HistogramArea::update(
|
|||||||
break;
|
break;
|
||||||
case ScopeType::PARADE:
|
case ScopeType::PARADE:
|
||||||
case ScopeType::WAVEFORM: {
|
case ScopeType::WAVEFORM: {
|
||||||
MyWriterLock wave_lock(wave_mutex);
|
MYWRITERLOCK(wave_lock, wave_mutex)
|
||||||
waveform_scale = waveformScale;
|
waveform_scale = waveformScale;
|
||||||
rwave = waveformRed;
|
rwave = waveformRed;
|
||||||
gwave = waveformGreen;
|
gwave = waveformGreen;
|
||||||
@ -1330,7 +1330,7 @@ void HistogramArea::updateBackBuffer ()
|
|||||||
|
|
||||||
cr->unset_dash();
|
cr->unset_dash();
|
||||||
|
|
||||||
MyReaderLock wave_lock(wave_mutex);
|
MYREADERLOCK(wave_lock, wave_mutex)
|
||||||
if (valid && (scopeType == ScopeType::HISTOGRAM || scopeType == ScopeType::HISTOGRAM_RAW)) {
|
if (valid && (scopeType == ScopeType::HISTOGRAM || scopeType == ScopeType::HISTOGRAM_RAW)) {
|
||||||
bool rawMode = scopeType == ScopeType::HISTOGRAM_RAW;
|
bool rawMode = scopeType == ScopeType::HISTOGRAM_RAW;
|
||||||
|
|
||||||
@ -1447,7 +1447,7 @@ void HistogramArea::updateBackBuffer ()
|
|||||||
} else if (scopeType == ScopeType::VECTORSCOPE_HC || scopeType == ScopeType::VECTORSCOPE_HS) {
|
} else if (scopeType == ScopeType::VECTORSCOPE_HC || scopeType == ScopeType::VECTORSCOPE_HS) {
|
||||||
drawVectorscope(cr, w, h);
|
drawVectorscope(cr, w, h);
|
||||||
}
|
}
|
||||||
wave_lock.release();
|
MYREADERLOCK_RELEASE(wave_lock);
|
||||||
|
|
||||||
// Draw the frame's border
|
// Draw the frame's border
|
||||||
style->render_frame(cr, 0, 0, surface->get_width(), surface->get_height());
|
style->render_frame(cr, 0, 0, surface->get_width(), surface->get_height());
|
||||||
|
@ -241,6 +241,7 @@ RTWindow::RTWindow ()
|
|||||||
RTImage::init();
|
RTImage::init();
|
||||||
WhiteBalance::init();
|
WhiteBalance::init();
|
||||||
MyExpander::init();
|
MyExpander::init();
|
||||||
|
FileBrowserEntry::init();
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
const std::vector<Glib::RefPtr<Gdk::Pixbuf>> appIcons = {
|
const std::vector<Glib::RefPtr<Gdk::Pixbuf>> appIcons = {
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#if STRICT_MUTEX && !NDEBUG
|
#if STRICT_MUTEX && !NDEBUG
|
||||||
|
|
||||||
|
MyMutex::MyMutex() : locked(false) {}
|
||||||
|
|
||||||
void MyMutex::checkLock ()
|
void MyMutex::checkLock ()
|
||||||
{
|
{
|
||||||
if (locked) {
|
if (locked) {
|
||||||
@ -61,13 +63,18 @@ void MyMutex::checkUnlock ()
|
|||||||
|
|
||||||
#if !TRACE_MYRWMUTEX
|
#if !TRACE_MYRWMUTEX
|
||||||
|
|
||||||
|
MyRWMutex::MyRWMutex() :
|
||||||
|
writerCount(0),
|
||||||
|
readerCount(0)
|
||||||
|
{}
|
||||||
|
|
||||||
void MyReaderLock::acquire ()
|
void MyReaderLock::acquire ()
|
||||||
{
|
{
|
||||||
if (locked) {
|
if (locked) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::Threads::Mutex::Lock lock (mutex.mutex);
|
std::unique_lock<std::mutex> lock (mutex.mutex);
|
||||||
|
|
||||||
if (mutex.writerCount == 0) {
|
if (mutex.writerCount == 0) {
|
||||||
// There's no writer operating, we can increment the writer count which will lock writers.
|
// There's no writer operating, we can increment the writer count which will lock writers.
|
||||||
@ -76,7 +83,7 @@ void MyReaderLock::acquire ()
|
|||||||
// The writer count is non null, but a reader can be the owner of the writer lock,
|
// The writer count is non null, but a reader can be the owner of the writer lock,
|
||||||
// which will be the case if the reader count is not zero too.
|
// which will be the case if the reader count is not zero too.
|
||||||
while (mutex.writerCount != 0) {
|
while (mutex.writerCount != 0) {
|
||||||
mutex.cond.wait(mutex.mutex);
|
mutex.cond.wait (lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then, we can increment the writer count.
|
// Then, we can increment the writer count.
|
||||||
@ -95,7 +102,7 @@ void MyReaderLock::release ()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::Threads::Mutex::Lock lock (mutex.mutex);
|
std::unique_lock<std::mutex> lock (mutex.mutex);
|
||||||
|
|
||||||
// decrement the writer number first...
|
// decrement the writer number first...
|
||||||
--mutex.readerCount;
|
--mutex.readerCount;
|
||||||
@ -105,7 +112,7 @@ void MyReaderLock::release ()
|
|||||||
--mutex.writerCount;
|
--mutex.writerCount;
|
||||||
|
|
||||||
// ...and signal the next waiting reader/writer that it's free
|
// ...and signal the next waiting reader/writer that it's free
|
||||||
mutex.cond.broadcast ();
|
mutex.cond.notify_all ();
|
||||||
}
|
}
|
||||||
|
|
||||||
locked = false;
|
locked = false;
|
||||||
@ -117,11 +124,11 @@ void MyWriterLock::acquire ()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::Threads::Mutex::Lock lock (mutex.mutex);
|
std::unique_lock<std::mutex> lock (mutex.mutex);
|
||||||
|
|
||||||
// The writer count is not zero, so we have to wait for it to be zero again...
|
// The writer count is not zero, so we have to wait for it to be zero again...
|
||||||
while (mutex.writerCount != 0) {
|
while (mutex.writerCount != 0) {
|
||||||
mutex.cond.wait (mutex.mutex);
|
mutex.cond.wait (lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ...then we can increment the writer count.
|
// ...then we can increment the writer count.
|
||||||
@ -136,12 +143,12 @@ void MyWriterLock::release ()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::Threads::Mutex::Lock lock (mutex.mutex);
|
std::unique_lock<std::mutex> lock (mutex.mutex);
|
||||||
|
|
||||||
// Decrement the writer number first...
|
// Decrement the writer number first...
|
||||||
if (--mutex.writerCount == 0) {
|
if (--mutex.writerCount == 0) {
|
||||||
// ...and if the writer count is zero again, we can wake up the next writer or reader.
|
// ...and if the writer count is zero again, we wake up all of the waiting writer or reader.
|
||||||
mutex.cond.broadcast ();
|
mutex.cond.notify_all ();
|
||||||
}
|
}
|
||||||
|
|
||||||
locked = false;
|
locked = false;
|
||||||
@ -154,13 +161,20 @@ namespace
|
|||||||
|
|
||||||
std::ostream& trace (const char* file, int line)
|
std::ostream& trace (const char* file, int line)
|
||||||
{
|
{
|
||||||
const auto currentThread = Glib::Threads::Thread::self ();
|
const auto currentThread = std::this_thread::get_id();
|
||||||
|
|
||||||
return std::cout << currentThread << ":" << file << ":" << line << ": ";
|
return std::cout << currentThread << ":" << file << ":" << line << ": ";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MyRWMutex::MyRWMutex() :
|
||||||
|
lastWriterFile(nullptr),
|
||||||
|
lastWriterLine(0),
|
||||||
|
writerCount(0),
|
||||||
|
readerCount(0)
|
||||||
|
{}
|
||||||
|
|
||||||
void MyReaderLock::acquire (const char* file, int line)
|
void MyReaderLock::acquire (const char* file, int line)
|
||||||
{
|
{
|
||||||
if (locked) {
|
if (locked) {
|
||||||
@ -170,7 +184,7 @@ void MyReaderLock::acquire (const char* file, int line)
|
|||||||
|
|
||||||
trace (file, line) << "Acquiring MyReaderLock..." << std::endl;
|
trace (file, line) << "Acquiring MyReaderLock..." << std::endl;
|
||||||
|
|
||||||
Glib::Threads::Mutex::Lock lock (mutex.mutex);
|
std::unique_lock<std::mutex> lock (mutex.mutex);
|
||||||
|
|
||||||
if (mutex.writerCount == 0) {
|
if (mutex.writerCount == 0) {
|
||||||
// There's no writer operating, we can increment the writer count which will lock writers.
|
// There's no writer operating, we can increment the writer count which will lock writers.
|
||||||
@ -184,13 +198,13 @@ void MyReaderLock::acquire (const char* file, int line)
|
|||||||
<< "\tLast writer file: " << mutex.lastWriterFile << std::endl
|
<< "\tLast writer file: " << mutex.lastWriterFile << std::endl
|
||||||
<< "\tLast writer line: " << mutex.lastWriterLine << std::endl;
|
<< "\tLast writer line: " << mutex.lastWriterLine << std::endl;
|
||||||
|
|
||||||
mutex.cond.wait(mutex.mutex);
|
mutex.cond.wait (lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then, we can increment the writer count.
|
// Then, we can increment the writer count.
|
||||||
++mutex.writerCount;
|
++mutex.writerCount;
|
||||||
|
|
||||||
mutex.ownerThread = Glib::Threads::Thread::self ();
|
mutex.ownerThread = std::this_thread::get_id ();
|
||||||
mutex.lastWriterFile = file;
|
mutex.lastWriterFile = file;
|
||||||
mutex.lastWriterLine = line;
|
mutex.lastWriterLine = line;
|
||||||
}
|
}
|
||||||
@ -211,7 +225,7 @@ void MyReaderLock::release (const char* file, int line)
|
|||||||
|
|
||||||
trace (file, line) << "Releasing MyReaderLock..." << std::endl;
|
trace (file, line) << "Releasing MyReaderLock..." << std::endl;
|
||||||
|
|
||||||
Glib::Threads::Mutex::Lock lock (mutex.mutex);
|
std::unique_lock<std::mutex> lock (mutex.mutex);
|
||||||
|
|
||||||
// decrement the writer number first...
|
// decrement the writer number first...
|
||||||
--mutex.readerCount;
|
--mutex.readerCount;
|
||||||
@ -221,9 +235,9 @@ void MyReaderLock::release (const char* file, int line)
|
|||||||
--mutex.writerCount;
|
--mutex.writerCount;
|
||||||
|
|
||||||
// ...and signal the next waiting reader/writer that it's free
|
// ...and signal the next waiting reader/writer that it's free
|
||||||
mutex.cond.broadcast ();
|
mutex.cond.notify_all ();
|
||||||
|
|
||||||
mutex.ownerThread = nullptr;
|
mutex.ownerThread = std::thread::id();
|
||||||
mutex.lastWriterFile = "";
|
mutex.lastWriterFile = "";
|
||||||
mutex.lastWriterLine = 0;
|
mutex.lastWriterLine = 0;
|
||||||
}
|
}
|
||||||
@ -241,7 +255,7 @@ void MyWriterLock::acquire (const char* file, int line)
|
|||||||
|
|
||||||
trace (file, line) << "Acquiring MyWriterLock..." << std::endl;
|
trace (file, line) << "Acquiring MyWriterLock..." << std::endl;
|
||||||
|
|
||||||
Glib::Threads::Mutex::Lock lock (mutex.mutex);
|
std::unique_lock<std::mutex> lock (mutex.mutex);
|
||||||
|
|
||||||
// The writer count is not zero, so we have to wait for it to be zero again...
|
// The writer count is not zero, so we have to wait for it to be zero again...
|
||||||
while (mutex.writerCount != 0) {
|
while (mutex.writerCount != 0) {
|
||||||
@ -250,13 +264,13 @@ void MyWriterLock::acquire (const char* file, int line)
|
|||||||
<< "\tLast writer file: " << mutex.lastWriterFile << std::endl
|
<< "\tLast writer file: " << mutex.lastWriterFile << std::endl
|
||||||
<< "\tLast writer line: " << mutex.lastWriterLine << std::endl;
|
<< "\tLast writer line: " << mutex.lastWriterLine << std::endl;
|
||||||
|
|
||||||
mutex.cond.wait (mutex.mutex);
|
mutex.cond.wait (lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ...then we can increment the writer count.
|
// ...then we can increment the writer count.
|
||||||
++mutex.writerCount;
|
++mutex.writerCount;
|
||||||
|
|
||||||
mutex.ownerThread = Glib::Threads::Thread::self ();
|
mutex.ownerThread = std::this_thread::get_id ();
|
||||||
mutex.lastWriterFile = file;
|
mutex.lastWriterFile = file;
|
||||||
mutex.lastWriterLine = line;
|
mutex.lastWriterLine = line;
|
||||||
|
|
||||||
@ -273,14 +287,14 @@ void MyWriterLock::release (const char* file, int line)
|
|||||||
|
|
||||||
trace (file, line) << "Releasing MyWriterLock..." << std::endl;
|
trace (file, line) << "Releasing MyWriterLock..." << std::endl;
|
||||||
|
|
||||||
Glib::Threads::Mutex::Lock lock (mutex.mutex);
|
std::unique_lock<std::mutex> lock (mutex.mutex);
|
||||||
|
|
||||||
// Decrement the writer number first...
|
// Decrement the writer number first...
|
||||||
if (--mutex.writerCount == 0) {
|
if (--mutex.writerCount == 0) {
|
||||||
// ...and if the writer count is zero again, we can wake up the next writer or reader.
|
// ...and if the writer count is zero again, we wake up all of the waiting writer or reader.
|
||||||
mutex.cond.broadcast ();
|
mutex.cond.notify_all ();
|
||||||
|
|
||||||
mutex.ownerThread = nullptr;
|
mutex.ownerThread = std::thread::id();
|
||||||
mutex.lastWriterFile = "";
|
mutex.lastWriterFile = "";
|
||||||
mutex.lastWriterLine = 0;
|
mutex.lastWriterLine = 0;
|
||||||
}
|
}
|
||||||
|
@ -24,14 +24,15 @@
|
|||||||
//#undef STRICT_MUTEX
|
//#undef STRICT_MUTEX
|
||||||
//#define STRICT_MUTEX 1
|
//#define STRICT_MUTEX 1
|
||||||
|
|
||||||
#include <glibmm/threads.h>
|
#include <mutex>
|
||||||
|
#include <thread>
|
||||||
|
#include <condition_variable>
|
||||||
#include "../rtengine/noncopyable.h"
|
#include "../rtengine/noncopyable.h"
|
||||||
|
|
||||||
#if STRICT_MUTEX && NDEBUG
|
#if STRICT_MUTEX && NDEBUG
|
||||||
using MyMutexBase = Glib::Threads::Mutex;
|
using MyMutexBase = std::mutex;
|
||||||
#else
|
#else
|
||||||
using MyMutexBase = Glib::Threads::RecMutex;
|
using MyMutexBase = std::recursive_mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,8 +55,10 @@ public:
|
|||||||
void unlock ();
|
void unlock ();
|
||||||
|
|
||||||
#if STRICT_MUTEX && !NDEBUG
|
#if STRICT_MUTEX && !NDEBUG
|
||||||
|
MyMutex();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool locked = false;
|
bool locked;
|
||||||
void checkLock ();
|
void checkLock ();
|
||||||
void checkUnlock ();
|
void checkUnlock ();
|
||||||
#endif
|
#endif
|
||||||
@ -66,8 +69,6 @@ class MyMutex::MyLock :
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit MyLock (MyMutex& mutex);
|
explicit MyLock (MyMutex& mutex);
|
||||||
MyLock (MyMutex& mutex, Glib::Threads::NotLock);
|
|
||||||
MyLock (MyMutex& mutex, Glib::Threads::TryLock);
|
|
||||||
|
|
||||||
~MyLock ();
|
~MyLock ();
|
||||||
|
|
||||||
@ -90,18 +91,20 @@ public:
|
|||||||
friend class MyReaderLock;
|
friend class MyReaderLock;
|
||||||
friend class MyWriterLock;
|
friend class MyWriterLock;
|
||||||
|
|
||||||
|
MyRWMutex();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Glib::Threads::Mutex mutex;
|
|
||||||
Glib::Threads::Cond cond;
|
|
||||||
|
|
||||||
std::size_t writerCount = 0;
|
|
||||||
std::size_t readerCount = 0;
|
|
||||||
|
|
||||||
#if TRACE_MYRWMUTEX
|
#if TRACE_MYRWMUTEX
|
||||||
Glib::Threads::Thread* ownerThread = nullptr;
|
std::thread::id ownerThread;
|
||||||
const char* lastWriterFile = "";
|
const char* lastWriterFile;
|
||||||
int lastWriterLine = 0;
|
int lastWriterLine;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
std::mutex mutex;
|
||||||
|
std::condition_variable cond;
|
||||||
|
|
||||||
|
std::size_t writerCount;
|
||||||
|
std::size_t readerCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -167,7 +170,7 @@ inline void MyMutex::lock ()
|
|||||||
|
|
||||||
inline bool MyMutex::trylock ()
|
inline bool MyMutex::trylock ()
|
||||||
{
|
{
|
||||||
if (MyMutexBase::trylock ()) {
|
if (MyMutexBase::try_lock ()) {
|
||||||
#if STRICT_MUTEX && !NDEBUG
|
#if STRICT_MUTEX && !NDEBUG
|
||||||
checkLock ();
|
checkLock ();
|
||||||
#endif
|
#endif
|
||||||
@ -194,18 +197,6 @@ inline MyMutex::MyLock::MyLock (MyMutex& mutex)
|
|||||||
mutex.lock();
|
mutex.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline MyMutex::MyLock::MyLock (MyMutex& mutex, Glib::Threads::NotLock)
|
|
||||||
: mutex (mutex)
|
|
||||||
, locked (false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline MyMutex::MyLock::MyLock (MyMutex& mutex, Glib::Threads::TryLock)
|
|
||||||
: mutex (mutex)
|
|
||||||
, locked (mutex.trylock ())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline MyMutex::MyLock::~MyLock ()
|
inline MyMutex::MyLock::~MyLock ()
|
||||||
{
|
{
|
||||||
if (locked) {
|
if (locked) {
|
||||||
|
@ -85,9 +85,9 @@ public:
|
|||||||
|
|
||||||
Glib::ThreadPool* threadPool_;
|
Glib::ThreadPool* threadPool_;
|
||||||
|
|
||||||
// Need to be a Glib::Threads::Mutex because used in a Glib::Threads::Cond object...
|
// Need to be a std::mutex because used in a std::condition_variable object...
|
||||||
// This is the only exceptions along with GThreadMutex (guiutils.cc), MyMutex is used everywhere else
|
// This is the only exceptions along with GThreadMutex (guiutils.cc), MyMutex is used everywhere else
|
||||||
Glib::Threads::Mutex mutex_;
|
std::mutex mutex_;
|
||||||
|
|
||||||
JobList jobs_;
|
JobList jobs_;
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ public:
|
|||||||
|
|
||||||
bool inactive_waiting_;
|
bool inactive_waiting_;
|
||||||
|
|
||||||
Glib::Threads::Cond inactive_;
|
std::condition_variable inactive_;
|
||||||
|
|
||||||
void
|
void
|
||||||
processNextJob()
|
processNextJob()
|
||||||
@ -103,7 +103,7 @@ public:
|
|||||||
Job j;
|
Job j;
|
||||||
|
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
|
|
||||||
// nothing to do; could be jobs have been removed
|
// nothing to do; could be jobs have been removed
|
||||||
if ( jobs_.empty() ) {
|
if ( jobs_.empty() ) {
|
||||||
@ -166,10 +166,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( --active_ == 0 ) {
|
if ( --active_ == 0 ) {
|
||||||
Glib::Threads::Mutex::Lock lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
if (inactive_waiting_) {
|
if (inactive_waiting_) {
|
||||||
inactive_waiting_ = false;
|
inactive_waiting_ = false;
|
||||||
inactive_.broadcast();
|
inactive_.notify_all();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -198,7 +198,7 @@ void ThumbImageUpdater::add(ThumbBrowserEntryBase* tbe, bool* priority, bool upg
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::Threads::Mutex::Lock lock(impl_->mutex_);
|
std::lock_guard<std::mutex> lock(impl_->mutex_);
|
||||||
|
|
||||||
// look up if an older version is in the queue
|
// look up if an older version is in the queue
|
||||||
Impl::JobList::iterator i(impl_->jobs_.begin());
|
Impl::JobList::iterator i(impl_->jobs_.begin());
|
||||||
@ -230,7 +230,7 @@ void ThumbImageUpdater::removeJobs(ThumbImageUpdateListener* listener)
|
|||||||
DEBUG("removeJobs(%p)", listener);
|
DEBUG("removeJobs(%p)", listener);
|
||||||
|
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lock(impl_->mutex_);
|
std::lock_guard<std::mutex> lock(impl_->mutex_);
|
||||||
|
|
||||||
for( Impl::JobList::iterator i(impl_->jobs_.begin()); i != impl_->jobs_.end(); ) {
|
for( Impl::JobList::iterator i(impl_->jobs_.begin()); i != impl_->jobs_.end(); ) {
|
||||||
if (i->listener_ == listener) {
|
if (i->listener_ == listener) {
|
||||||
@ -246,9 +246,9 @@ void ThumbImageUpdater::removeJobs(ThumbImageUpdateListener* listener)
|
|||||||
while ( impl_->active_ != 0 ) {
|
while ( impl_->active_ != 0 ) {
|
||||||
DEBUG("waiting for running jobs1");
|
DEBUG("waiting for running jobs1");
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lock(impl_->mutex_);
|
std::unique_lock<std::mutex> lock(impl_->mutex_);
|
||||||
impl_->inactive_waiting_ = true;
|
impl_->inactive_waiting_ = true;
|
||||||
impl_->inactive_.wait(impl_->mutex_);
|
impl_->inactive_.wait(lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -258,7 +258,7 @@ void ThumbImageUpdater::removeAllJobs()
|
|||||||
DEBUG("stop");
|
DEBUG("stop");
|
||||||
|
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lock(impl_->mutex_);
|
std::lock_guard<std::mutex> lock(impl_->mutex_);
|
||||||
|
|
||||||
impl_->jobs_.clear();
|
impl_->jobs_.clear();
|
||||||
}
|
}
|
||||||
@ -266,9 +266,9 @@ void ThumbImageUpdater::removeAllJobs()
|
|||||||
while ( impl_->active_ != 0 ) {
|
while ( impl_->active_ != 0 ) {
|
||||||
DEBUG("waiting for running jobs2");
|
DEBUG("waiting for running jobs2");
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lock(impl_->mutex_);
|
std::unique_lock<std::mutex> lock(impl_->mutex_);
|
||||||
impl_->inactive_waiting_ = true;
|
impl_->inactive_waiting_ = true;
|
||||||
impl_->inactive_.wait(impl_->mutex_);
|
impl_->inactive_.wait(lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,8 +225,11 @@ ModifyInstallNames 2>&1
|
|||||||
# Copy libpng16 to the app bundle
|
# Copy libpng16 to the app bundle
|
||||||
cp ${LOCAL_PREFIX}/lib/libpng16.16.dylib "${CONTENTS}/Frameworks/libpng16.16.dylib"
|
cp ${LOCAL_PREFIX}/lib/libpng16.16.dylib "${CONTENTS}/Frameworks/libpng16.16.dylib"
|
||||||
|
|
||||||
# Copy libtiff 5 into the app bundle
|
# Copy graphite to Frameworks
|
||||||
cp ${LOCAL_PREFIX}/lib/libtiff.5.dylib "${CONTENTS}/Frameworks/libtiff.5.dylib"
|
cp ${LOCAL_PREFIX}/lib/libgraphite2.3.dylib "${CONTENTS}/Frameworks"
|
||||||
|
|
||||||
|
# Copy libtiff 6 into the app bundle
|
||||||
|
cp ${LOCAL_PREFIX}/lib/libtiff.6.dylib "${CONTENTS}/Frameworks/libtiff.6.dylib"
|
||||||
|
|
||||||
# Copy libomp to Frameworks
|
# Copy libomp to Frameworks
|
||||||
cp ${LOCAL_PREFIX}/lib/libomp.dylib "${CONTENTS}/Frameworks"
|
cp ${LOCAL_PREFIX}/lib/libomp.dylib "${CONTENTS}/Frameworks"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user