Twitch SDK (Internal)
standardthread.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 
13 #include "twitchsdk/core/thread.h"
14 
15 #include <thread>
16 
17 
18 namespace ttv
19 {
20  class StandardThread;
21  class StandardThreadFactory;
22 }
23 
24 
26 {
27 public:
28  StandardThread(ThreadProc threadProc, const std::string& name);
30 
31  virtual void Run();
32  virtual bool Joinable() const;
33  virtual void Join();
34 
35 private:
37  std::string mName;
38  std::unique_ptr<std::thread> mThread;
39 };
40 
41 
43 {
44 public:
45  virtual ~StandardThreadFactory();
46  virtual TTV_ErrorCode CreateThread(ThreadProc threadProc, const std::string& name, std::shared_ptr<IThread>& result);
47 };
virtual void Join()
StandardThread(ThreadProc threadProc, const std::string &name)
Definition: standardthread.h:25
std::string mName
Definition: standardthread.h:37
std::unique_ptr< std::thread > mThread
Definition: standardthread.h:38
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
ThreadProc mThreadProc
Definition: standardthread.h:36
virtual void Run()
Definition: standardthread.h:42
TTV_ErrorCode CreateThread(ThreadProc threadProc, const std::string &name, std::shared_ptr< IThread > &result)
virtual bool Joinable() const
uint32_t TTV_ErrorCode
Definition: errortypes.h:30
std::function< void()> ThreadProc
Definition: thread.h:22
Definition: thread.h:52
Definition: thread.h:38