summaryrefslogtreecommitdiff
path: root/tools/gator/daemon/Source.cpp
blob: 15122deb6ecfb44d20069c19fb8e0609b8452880 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
 * Copyright (C) ARM Limited 2010-2016. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include "Source.h"

#include "Logging.h"

Source::Source() : mThreadID() {
}

Source::~Source() {
}

void Source::start() {
	if (pthread_create(&mThreadID, NULL, runStatic, this)) {
		logg.logError("Failed to create source thread");
		handleException();
	}
}

void Source::join() {
	pthread_join(mThreadID, NULL);
}

void *Source::runStatic(void *arg) {
	static_cast<Source *>(arg)->run();
	return NULL;
}