File: test_schedule.cpp

package info (click to toggle)
rkcommon 1.14.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,304 kB
  • sloc: cpp: 33,504; sh: 31; makefile: 13
file content (24 lines) | stat: -rw-r--r-- 384 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright 2009 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#include "../catch.hpp"

#include "rkcommon/tasking/schedule.h"

#include <atomic>

using rkcommon::tasking::schedule;

TEST_CASE("schedule", "[schedule]")
{
  std::atomic<int> val{0};

  auto *val_p = &val;

  schedule([=]() { *val_p = 1; });

  while (val.load() == 0)
    ;

  REQUIRE(val.load() == 1);
}