Repository navigation
Conversation
|
Nice catch! However, any writing or reading of |
|
So maybe we use a rw_lock? C++17 implements shared_lock, but we're using C++11. We could implement ourselves like this: class SharedLock {
std::mutex rw_mutex;
std::condition_variable rw_cv;
uintmax_t readers = 0;
bool has_writer = false;
public:
explicit SharedLock() = default;
void lock_shared() {
std::unique_lock<std::mutex> lock(rw_mutex);
if (has_writer)
rw_cv.wait(lock);
readers++;
}
void unlock_shared() {
std::lock_guard<std::mutex> lock(rw_mutex);
readers--;
if (readers == 0)
rw_cv.notify_all();
}
void lock() {
std::unique_lock<std::mutex> lock(rw_mutex);
if (readers != 0 || has_writer)
rw_cv.wait(lock, [&]() { return (!has_writer && readers == 0); });
has_writer = true;
}
void unlock() {
std::lock_guard<std::mutex> lock(rw_mutex);
has_writer = false;
rw_cv.notify_all();
}
};or increase Glibmm dependency by using |
Indeed, on |
Agree. Anyway I think better to reverse logic, and use list of child nodes (std::shared_ptr).
I think yes. As far as I can see all those usages is mostly a copy-paste code, so it looks like we need to do a cleanup-refactor iteration for this. |
Yes, and for me it's better to continue using it. This way, in the future, we can easily switch to std. Also for newcomers this code is much easier to understand. |
I don't know why it isn't in the two ways. |
Agree. I mean multiple parents. |
|
I search for test files and I found out that a "parent set" is "needed": Hera.sif available here https://forums.synfig.org/t/wip-spy-vs-spy/10526/2 |
As I understand from that messages it only needed for |
|
I'm not sure if it's only for |
|
@ice0 do you want me to fix the |
| synfig::Color color_func(const synfig::Point &x, int quality=10, synfig::ColorReal supersample=0)const; | ||
|
|
||
| mutable std::mutex mutex; | ||
| std::mutex mutex; |
There was a problem hiding this comment.
Why did you remove mutable? In C++11, it's totally OK to use mutable with thread-safe variables, like mutex, atomic, etc.
There was a problem hiding this comment.
That said, I think we should audit all mutable and const_cast on code to fix them ;)
|
@ice0 could you rebase? :) |
|
ping |
|
ping :) |
No description provided.