Chinmay Garde e356dbca2c
Merge flutter/synchronization contents into fml. (#8525)
When flutter/synchronization was first authored, we did not own fml (it was called fxl then). Now we do, so use a single spot for such utilities. The pipeline was meant to be a general purpose utility that was only ever used by the animator (it even has animator specific tracing), so move that to shell instead (where the animator resides).
2019-04-09 19:18:51 -07:00

39 lines
747 B
C++

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_FML_SYNCHRONIZATION_SEMAPHORE_H_
#define FLUTTER_FML_SYNCHRONIZATION_SEMAPHORE_H_
#include <memory>
#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/macros.h"
namespace fml {
class PlatformSemaphore;
class Semaphore {
public:
explicit Semaphore(uint32_t count);
~Semaphore();
bool IsValid() const;
FML_WARN_UNUSED_RESULT
bool TryWait();
void Signal();
private:
std::unique_ptr<PlatformSemaphore> _impl;
FML_DISALLOW_COPY_AND_ASSIGN(Semaphore);
};
} // namespace fml
#endif // FLUTTER_FML_SYNCHRONIZATION_SEMAPHORE_H_