mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
fix(db): fix env compile error
Former-commit-id: aaf0f190a14e88cdfeb69e6ededc14f739181841
This commit is contained in:
parent
89125a9fb6
commit
ea1241dc21
@ -1,16 +1,15 @@
|
||||
#include <assert.h>
|
||||
#include "env.h"
|
||||
|
||||
namespace zilliz {
|
||||
namespace vecwise {
|
||||
namespace engine {
|
||||
|
||||
Env::Env()
|
||||
: _bg_work_cv(&_bg_work_mutex),
|
||||
_bg_work_started(false) {
|
||||
Env::Env() : _bg_work_started(false) {
|
||||
}
|
||||
|
||||
void Env::schedule(void (*function_)(void* arg_), void* arg_) {
|
||||
std::lock_guard<std::mutex> lock;
|
||||
std::unique_lock<std::mutex> lock(_bg_work_mutex);
|
||||
|
||||
if (!_bg_work_started) {
|
||||
_bg_work_started = true;
|
||||
@ -27,9 +26,9 @@ void Env::schedule(void (*function_)(void* arg_), void* arg_) {
|
||||
|
||||
void Env::backgroud_thread_main() {
|
||||
while (true) {
|
||||
std::lock_guard<std::mutex> lock;
|
||||
std::unique_lock<std::mutex> lock(_bg_work_mutex);
|
||||
while (_bg_work_queue.empty()) {
|
||||
_bg_work_cv.wait();
|
||||
_bg_work_cv.wait(lock);
|
||||
}
|
||||
|
||||
assert(!_bg_work_queue.empty());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user