blob: 64d6206895b0f755176a47931269885255f970a9 [file] [log] [blame]
Jon Medhurst15ce78d2014-04-10 09:02:02 +01001/**
Jon Medhurstb1d07442015-05-08 12:04:18 +01002 * Copyright (C) ARM Limited 2010-2015. All rights reserved.
Jon Medhurst15ce78d2014-04-10 09:02:02 +01003 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include "Source.h"
10
11#include "Logging.h"
12
13Source::Source() : mThreadID() {
14}
15
16Source::~Source() {
17}
18
19void Source::start() {
20 if (pthread_create(&mThreadID, NULL, runStatic, this)) {
Jon Medhurstb1d07442015-05-08 12:04:18 +010021 logg->logError("Failed to create source thread");
Jon Medhurst15ce78d2014-04-10 09:02:02 +010022 handleException();
23 }
24}
25
26void Source::join() {
27 pthread_join(mThreadID, NULL);
28}
29
30void *Source::runStatic(void *arg) {
31 static_cast<Source *>(arg)->run();
32 return NULL;
33}