include/mgba/feature/thread-proxy.h (view raw)
1/* Copyright (c) 2013-2017 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef VIDEO_THREAD_PROXY_H
7#define VIDEO_THREAD_PROXY_H
8
9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13#include <mgba/internal/gba/video.h>
14#include "video-logger.h"
15#include <mgba-util/threading.h>
16#include <mgba-util/ring-fifo.h>
17
18enum mVideoThreadProxyState {
19 PROXY_THREAD_STOPPED = 0,
20 PROXY_THREAD_IDLE,
21 PROXY_THREAD_BUSY
22};
23
24struct mVideoThreadProxy {
25 struct mVideoLogger d;
26
27 Thread thread;
28 Condition fromThreadCond;
29 Condition toThreadCond;
30 Mutex mutex;
31 enum mVideoThreadProxyState threadState;
32 enum mVideoLoggerEvent event;
33
34 struct RingFIFO dirtyQueue;
35};
36
37void mVideoThreadProxyCreate(struct mVideoThreadProxy* renderer);
38
39CXX_GUARD_END
40
41#endif