// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef PLATFORM_API_TASK_RUNNER_H_ #define PLATFORM_API_TASK_RUNNER_H_ #include <future> #include <utility> #include "platform/api/time.h" namespace openscreen { // A thread-safe API surface that allows for posting tasks. The underlying // implementation may be single or multi-threaded, and all complication should // be handled by the implementation class. The implementation must guarantee: // (1) Tasks shall not overlap in time/CPU. // (2) Tasks shall run sequentially, e.g. posting task A then B implies // that A shall run before B. // (3) If task A is posted before task B, then any mutation in A happens-before // B runs (even if A and B run on different threads). class TaskRunner { … }; } // namespace openscreen #endif // PLATFORM_API_TASK_RUNNER_H_