Merge remote-tracking branch 'lsk/v3.10/topic/arm64-cpuidle' into linux-linaro-lsk
[firefly-linux-kernel-4.4.55.git] / tools / gator / daemon / Source.cpp
1 /**
2  * Copyright (C) ARM Limited 2010-2014. All rights reserved.
3  *
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
13 Source::Source() : mThreadID() {
14 }
15
16 Source::~Source() {
17 }
18
19 void Source::start() {
20         if (pthread_create(&mThreadID, NULL, runStatic, this)) {
21                 logg->logError(__FILE__, __LINE__, "Failed to create source thread");
22                 handleException();
23         }
24 }
25
26 void Source::join() {
27         pthread_join(mThreadID, NULL);
28 }
29
30 void *Source::runStatic(void *arg) {
31         static_cast<Source *>(arg)->run();
32         return NULL;
33 }