Jon Medhurst | 15ce78d | 2014-04-10 09:02:02 +0100 | [diff] [blame] | 1 | /** |
Jon Medhurst | b1d0744 | 2015-05-08 12:04:18 +0100 | [diff] [blame] | 2 | * Copyright (C) ARM Limited 2010-2015. All rights reserved. |
Jon Medhurst | 15ce78d | 2014-04-10 09:02:02 +0100 | [diff] [blame] | 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)) { |
Jon Medhurst | b1d0744 | 2015-05-08 12:04:18 +0100 | [diff] [blame] | 21 | logg->logError("Failed to create source thread"); |
Jon Medhurst | 15ce78d | 2014-04-10 09:02:02 +0100 | [diff] [blame] | 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 | } |