| 1 |
/* |
| 2 |
* Copyright (C) 2024 Linux Studio Plugins Project <https://lsp-plug.in/> |
| 3 |
* (C) 2024 Vladimir Sadovnikov <[email protected]> |
| 4 |
* |
| 5 |
* This file is part of lsp-runtime-lib |
| 6 |
* Created on: 27 янв. 2016 г. |
| 7 |
* |
| 8 |
* lsp-runtime-lib is free software: you can redistribute it and/or modify |
| 9 |
* it under the terms of the GNU Lesser General Public License as published by |
| 10 |
* the Free Software Foundation, either version 3 of the License, or |
| 11 |
* any later version. |
| 12 |
* |
| 13 |
* lsp-runtime-lib is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU Lesser General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU Lesser General Public License |
| 19 |
* along with lsp-runtime-lib. If not, see <https://www.gnu.org/licenses/>. |
| 20 |
*/ |
| 21 |
|
| 22 |
#include <lsp-plug.in/common/types.h> |
| 23 |
#include <lsp-plug.in/ipc/IExecutor.h> |
| 24 |
|
| 25 |
namespace lsp |
| 26 |
{ |
| 27 |
namespace ipc |
| 28 |
{ |
| 29 |
IExecutor::IExecutor() |
| 30 |
{ |
| 31 |
} |
| 32 |
|
| 33 |
IExecutor::~IExecutor() |
| 34 |
{ |
| 35 |
} |
| 36 |
|
| 37 |
void IExecutor::run_task(ITask *task) |
| 38 |
{ |
| 39 |
atomic_store(&task->nState, ITask::TS_RUNNING); |
| 40 |
task->nCode = 0; |
| 41 |
|
| 42 |
task->nCode = task->run(); |
| 43 |
|
| 44 |
atomic_store(&task->nState, ITask::TS_COMPLETED); |
| 45 |
|
| 46 |
// Run callback method |
| 47 |
task_finished(task); |
| 48 |
} |
| 49 |
|
| 50 |
void IExecutor::task_finished(ITask *task) |
| 51 |
{ |
| 52 |
// Call nested executor (if any) |
| 53 |
if (task->pExecutor != NULL) |
| 54 |
task->pExecutor->task_finished(task); |
| 55 |
} |
| 56 |
|
| 57 |
bool IExecutor::submit(ITask *task) |
| 58 |
{ |
| 59 |
return false; |
| 60 |
} |
| 61 |
|
| 62 |
void IExecutor::shutdown() |
| 63 |
{ |
| 64 |
} |
| 65 |
} /* namespace lsp */ |
| 66 |
} /* namespace lsp */ |