Commit fadd9dfa by Nicolas Capens

Update Marl to 3285a2dfb

Changes: 3285a2dfb Workaround MSAN false-positive 6bf128cab Assert that threads are joined before destruction 06b72af16 Scheduler: Add a couple of asserts Commands: ./third_party/update-marl.sh --squash Bug: b/140546382 Change-Id: I8df3d233e0dd6bf2e9ebfe85bbd7630c902a6678
parents 2be25f08 b66407c6
......@@ -17,6 +17,7 @@
#include "marl/scheduler.h"
#include "marl/debug.h"
#include "marl/sanitizers.h"
#include "marl/thread.h"
#include "marl/trace.h"
......@@ -91,7 +92,13 @@ Scheduler* Scheduler::get() {
}
void Scheduler::bind() {
#if !MEMORY_SANITIZER_ENABLED
// thread_local variables in shared libraries are initialized at load-time,
// but this is not observed by MemorySanitizer if the loader itself was not
// instrumented, leading to false-positive unitialized variable errors.
// See https://github.com/google/marl/issues/184
MARL_ASSERT(bound == nullptr, "Scheduler already bound");
#endif
bound = this;
{
marl::lock lock(singleThreadedWorkers.mutex);
......@@ -237,10 +244,16 @@ void Scheduler::Fiber::notify() {
}
void Scheduler::Fiber::wait(marl::lock& lock, const Predicate& pred) {
MARL_ASSERT(worker == Worker::getCurrent(),
"Scheduler::Fiber::wait() must only be called on the currently "
"executing fiber");
worker->wait(lock, nullptr, pred);
}
void Scheduler::Fiber::switchTo(Fiber* to) {
MARL_ASSERT(worker == Worker::getCurrent(),
"Scheduler::Fiber::switchTo() must only be called on the "
"currently executing fiber");
if (to != this) {
impl->switchTo(to->impl.get());
}
......
......@@ -402,11 +402,13 @@ Thread::Thread(Affinity&& affinity, Func&& func)
: impl(new Thread::Impl(std::move(affinity), std::move(func))) {}
Thread::~Thread() {
delete impl;
MARL_ASSERT(!impl, "Thread::join() was not called before destruction");
}
void Thread::join() {
impl->thread.join();
delete impl;
impl = nullptr;
}
void Thread::setName(const char* fmt, ...) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment