Theora Playback Library  1.1.0
TheoraAsync.h
Go to the documentation of this file.
1 /************************************************************************************
2 This source file is part of the Theora Video Playback Library
3 For latest info, see http://libtheoraplayer.googlecode.com
4 *************************************************************************************
5 Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
6 This program is free software; you can redistribute it and/or modify it under
7 the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
8 *************************************************************************************/
9 #ifndef _TheoraAsync_h
10 #define _TheoraAsync_h
11 
12 #include <stdlib.h>
13 #ifndef _WIN32
14 #include <pthread.h>
15 #endif
16 
19 {
20 public:
21  class ScopeLock
22  {
23  public:
24  ScopeLock(TheoraMutex* mutex = NULL, bool logUnhandledUnlocks = true);
25  ~ScopeLock();
26  bool acquire(TheoraMutex* mutex);
27  bool release();
28 
29  protected:
32 
33  };
34 
35  TheoraMutex();
36  ~TheoraMutex();
37  void lock();
38  void unlock();
39 
40 protected:
41  void* mHandle;
42 
43 };
44 
47 {
48  TheoraMutex mRunningMutex;
49 public:
50  TheoraThread();
51  virtual ~TheoraThread();
52  void start();
53  void stop();
54  void resume();
55  void pause();
56  bool isRunning();
57  virtual void execute() = 0;
58  void join();
59 
60 protected:
61  void* mId;
62  volatile bool mRunning;
63 
64 };
65 
66 #endif
Definition: TheoraAsync.h:21
void * mId
Definition: TheoraAsync.h:61
Definition: TheoraAsync.h:46
Definition: TheoraAsync.h:18
virtual ~TheoraThread()
void * mHandle
Definition: TheoraAsync.h:41
bool mLogUnhandledUnlocks
Definition: TheoraAsync.h:31
bool isRunning()
ScopeLock(TheoraMutex *mutex=NULL, bool logUnhandledUnlocks=true)
volatile bool mRunning
Definition: TheoraAsync.h:62
TheoraMutex * mMutex
Definition: TheoraAsync.h:30
bool acquire(TheoraMutex *mutex)
virtual void execute()=0
void unlock()