Twitch SDK (Internal)
standardthreadsync.h
Go to the documentation of this file.
1 /********************************************************************************************
2 * Twitch Broadcasting SDK
3 *
4 * This software is supplied under the terms of a license agreement with Twitch Interactive, Inc. and
5 * may not be copied or used except in accordance with the terms of that agreement
6 * Copyright (c) 2012-2016 Twitch Interactive, Inc.
7 *********************************************************************************************/
8 
9 #pragma once
10 
12 
13 #include <memory>
14 #include <condition_variable>
15 #include <mutex>
16 
17 
18 namespace ttv
19 {
20  class StandardThreadSync;
21  class StandardThreadSyncFactory;
22 }
23 
24 
26 {
27 public:
29 
30  virtual TTV_ErrorCode Suspend() override;
31  virtual TTV_ErrorCode SuspendFor(uint duration) override;
32  virtual TTV_ErrorCode Signal() override;
33 
34 private:
35  std::condition_variable mSyncAtom;
36  std::mutex mMutex;
37 
38  bool mFallthru; // fall-thru will be on if a thread signal is signaled but without any threads suspended
39  // used for non windows implementations to emulate a self resetting event
40 };
41 
42 
44 {
45 public:
46  virtual TTV_ErrorCode CreateThreadSync(std::shared_ptr<IThreadSync>& result) override;
47 };
TTV_ErrorCode CreateThreadSync(std::shared_ptr< IThreadSync > &result)
Definition: threadsync.h:25
Definition: standardthreadsync.h:25
bool mFallthru
Definition: standardthreadsync.h:38
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
virtual TTV_ErrorCode Suspend() override
virtual TTV_ErrorCode Signal() override
uint32_t TTV_ErrorCode
Definition: errortypes.h:30
std::mutex mMutex
Definition: standardthreadsync.h:36
std::condition_variable mSyncAtom
Definition: standardthreadsync.h:35
unsigned int uint
Definition: coretypes.h:18
Definition: threadsync.h:36
Definition: standardthreadsync.h:43
virtual TTV_ErrorCode SuspendFor(uint duration) override