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

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

S
superjom 已提交
6 7 8 9 10
namespace visualdl {

int counter = 0;

TEST(concurrency, test) {
S
Superjom 已提交
11 12
  cc::PeriodExector executor;
  cc::PeriodExector::task_t task = [&]() {
S
superjom 已提交
13 14 15 16
    LOG(INFO) << "Hello " << counter++;
    if (counter > 5) return false;
    return true;
  };
S
Superjom 已提交
17
  executor(std::move(task), 200);
S
superjom 已提交
18 19
}

S
superjom 已提交
20
}  // namespace visualdl