Skip to content

Commit 8f11390

Browse files
committed
Reduced poll interval for ipc::NativeExecutor to 20 milliseconds
1 parent 66a18c8 commit 8f11390

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*******************************************************************************
44

55
=== 1.0.28 ===
6+
* Reduced poll interval for ipc::NativeExecutor to 20 milliseconds.
67
* Fixed invalid access to missing built-in resources.
78
* Fixed some command line options that caused JACK version to crash.
89
* Updated build scripts.

include/lsp-plug.in/ipc/NativeExecutor.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (C) 2024 Linux Studio Plugins Project <https://lsp-plug.in/>
3-
* (C) 2024 Vladimir Sadovnikov <[email protected]>
2+
* Copyright (C) 2025 Linux Studio Plugins Project <https://lsp-plug.in/>
3+
* (C) 2025 Vladimir Sadovnikov <[email protected]>
44
*
55
* This file is part of lsp-runtime-lib
66
* Created on: 27 янв. 2016 г.
@@ -19,8 +19,8 @@
1919
* along with lsp-runtime-lib. If not, see <https://www.gnu.org/licenses/>.
2020
*/
2121

22-
#ifndef IPC_NATIVEEXECUTOR_H_
23-
#define IPC_NATIVEEXECUTOR_H_
22+
#ifndef LSP_PLUG_IN_IPC_NATIVEEXECUTOR_H_
23+
#define LSP_PLUG_IN_IPC_NATIVEEXECUTOR_H_
2424

2525
#include <lsp-plug.in/runtime/version.h>
2626
#include <lsp-plug.in/common/atomic.h>
@@ -81,4 +81,4 @@ namespace lsp
8181
} /* namespace ipc */
8282
} /* namespace lsp */
8383

84-
#endif /* IPC_NATIVEEXECUTOR_H_ */
84+
#endif /* LSP_PLUG_IN_IPC_NATIVEEXECUTOR_H_ */

src/main/ipc/NativeExecutor.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (C) 2024 Linux Studio Plugins Project <https://lsp-plug.in/>
3-
* (C) 2024 Vladimir Sadovnikov <[email protected]>
2+
* Copyright (C) 2025 Linux Studio Plugins Project <https://lsp-plug.in/>
3+
* (C) 2025 Vladimir Sadovnikov <[email protected]>
44
*
55
* This file is part of lsp-runtime-lib
66
* Created on: 27 янв. 2016 г.
@@ -26,6 +26,8 @@ namespace lsp
2626
{
2727
namespace ipc
2828
{
29+
static constexpr size_t POLL_INTERVAL = 20;
30+
2931
NativeExecutor::NativeExecutor():
3032
hThread(execute, this)
3133
{
@@ -88,7 +90,7 @@ namespace lsp
8890
atomic_unlock(nLock);
8991
}
9092

91-
ipc::Thread::sleep(100);
93+
ipc::Thread::sleep(POLL_INTERVAL);
9294
}
9395

9496
// Now there are no pending tasks, terminate thread
@@ -105,7 +107,7 @@ namespace lsp
105107
// Sleep until critical section is acquired
106108
while (!atomic_trylock(nLock))
107109
{
108-
if (ipc::Thread::sleep(100) == STATUS_CANCELLED)
110+
if (ipc::Thread::sleep(POLL_INTERVAL) == STATUS_CANCELLED)
109111
return;
110112
}
111113

@@ -117,7 +119,7 @@ namespace lsp
117119
atomic_unlock(nLock);
118120

119121
// Wait for a while
120-
if (ipc::Thread::sleep(100) == STATUS_CANCELLED)
122+
if (ipc::Thread::sleep(POLL_INTERVAL) == STATUS_CANCELLED)
121123
return;
122124
}
123125
else
@@ -132,8 +134,13 @@ namespace lsp
132134

133135
// Execute task
134136
lsp_trace("executing task %p", task);
137+
const system::time_millis_t start = system::get_time_millis();
138+
135139
run_task(task);
136-
lsp_trace("executed task %p with code %d", task, int(task->code()));
140+
141+
const system::time_millis_t end = system::get_time_millis();
142+
lsp_trace("executed task %p with code %d, time=%d ms",
143+
task, int(task->code()), int(end - start));
137144
}
138145
}
139146
}

0 commit comments

Comments
 (0)