db/update/Service: use EventLoop::IsInside()

Don't use the global variable "main_thread".
This commit is contained in:
Max Kellermann 2014-02-04 18:42:07 +01:00
parent abc16b919d
commit c5fa8ed321

View File

@ -31,6 +31,10 @@
#include "thread/Thread.hxx" #include "thread/Thread.hxx"
#include "thread/Util.hxx" #include "thread/Util.hxx"
#ifndef NDEBUG
#include "event/Loop.hxx"
#endif
#include <assert.h> #include <assert.h>
inline void inline void
@ -73,7 +77,7 @@ UpdateService::Task(void *ctx)
void void
UpdateService::StartThread(UpdateQueueItem &&i) UpdateService::StartThread(UpdateQueueItem &&i)
{ {
assert(main_thread.IsInside()); assert(GetEventLoop().IsInside());
progress = UPDATE_PROGRESS_RUNNING; progress = UPDATE_PROGRESS_RUNNING;
modified = false; modified = false;
@ -100,7 +104,7 @@ UpdateService::GenerateId()
unsigned unsigned
UpdateService::Enqueue(const char *path, bool discard) UpdateService::Enqueue(const char *path, bool discard)
{ {
assert(main_thread.IsInside()); assert(GetEventLoop().IsInside());
if (progress != UPDATE_PROGRESS_IDLE) { if (progress != UPDATE_PROGRESS_IDLE) {
const unsigned id = GenerateId(); const unsigned id = GenerateId();