test_concurrency.cc 394 字节
Newer Older
S
superjom 已提交
1 2 3
#include "visualdl/backend/utils/concurrency.h"

#include <glog/logging.h>
S
superjom 已提交
4 5
#include <gtest/gtest.h>

S
superjom 已提交
6 7 8 9 10 11 12 13 14 15 16 17 18 19
namespace visualdl {

int counter = 0;

TEST(concurrency, test) {
  cc::PeriodExector::task_t task = [&counter]() {
    LOG(INFO) << "Hello " << counter++;
    if (counter > 5) return false;
    return true;
  };
  cc::PeriodExector::Global()(std::move(task), 200);
}

}  // namespace visualdl