Mercurial > hg > qm-dsp
comparison thread/AsynchronousTask.h @ 489:701233f8ed41
Make include-guards consistent
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Fri, 31 May 2019 16:48:37 +0100 |
parents | 2aed32965291 |
children |
comparison
equal
deleted
inserted
replaced
488:7992d0923626 | 489:701233f8ed41 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ |
2 | |
3 /* | 2 /* |
4 QM DSP Library | 3 QM DSP Library |
5 | 4 |
6 Centre for Digital Music, Queen Mary, University of London. | 5 Centre for Digital Music, Queen Mary, University of London. |
7 This file Copyright 2009 QMUL. | 6 This file Copyright 2009 QMUL. |
8 */ | 7 */ |
9 | 8 |
10 #ifndef _ASYNCHRONOUS_TASK_H_ | 9 #ifndef QM_DSP_ASYNCHRONOUS_TASK_H |
11 #define _ASYNCHRONOUS_TASK_H_ | 10 #define QM_DSP_ASYNCHRONOUS_TASK_H |
12 | 11 |
13 #include "Thread.h" | 12 #include "Thread.h" |
14 | 13 |
15 #include <iostream> | 14 #include <iostream> |
16 | 15 |
40 public: | 39 public: |
41 AsynchronousTask() : | 40 AsynchronousTask() : |
42 m_todo("AsynchronousTask: task to perform"), | 41 m_todo("AsynchronousTask: task to perform"), |
43 m_done("AsynchronousTask: task complete"), | 42 m_done("AsynchronousTask: task complete"), |
44 m_inTask(false), | 43 m_inTask(false), |
45 m_finishing(false) | 44 m_finishing(false) { |
46 { | |
47 start(); | 45 start(); |
48 } | 46 } |
49 virtual ~AsynchronousTask() | 47 |
50 { | 48 virtual ~AsynchronousTask() { |
51 m_todo.lock(); | 49 m_todo.lock(); |
52 m_finishing = true; | 50 m_finishing = true; |
53 m_todo.signal(); | 51 m_todo.signal(); |
54 m_todo.unlock(); | 52 m_todo.unlock(); |
55 wait(); | 53 wait(); |