JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_ChildProcessManager.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
45 {
46 public:
47 #ifndef DOXYGEN
49 #endif
50
59 template <typename... Args>
61 {
62 auto p = std::make_shared<ChildProcess>();
63
64 if (! p->start (std::forward<Args> (args)...))
65 return nullptr;
66
67 processes.insert (p);
68 timer.startTimer (1000);
69
70 return p;
71 }
72
78 {
79 return listeners.addListener (std::move (listener));
80 }
81
85 auto hasRunningProcess() const
86 {
87 return timer.isTimerRunning();
88 }
89
90 private:
91 ChildProcessManager() = default;
92 ~ChildProcessManager() override { clearSingletonInstance(); }
93
94 void checkProcesses();
95
97 detail::CallbackListenerList<ChildProcess*> listeners;
98 TimedCallback timer { [this] { checkProcesses(); } };
99 };
100
101} // namespace juce
Manages a set of ChildProcesses and periodically checks their return value.
auto addChildProcessExitedListener(std::function< void(ChildProcess *)> listener)
Registers a callback function that is called for every ChildProcess that terminated.
auto hasRunningProcess() const
Returns true if the ChildProcessManager contains any running ChildProcesses that it's monitoring.
std::shared_ptr< ChildProcess > createAndStartManagedChildProcess(Args &&... args)
Creates a new ChildProcess and starts it with the provided arguments.
Launches and monitors a child process.
Classes derived from this will be automatically deleted when the application exits.
#define JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL(Classname)
Macro to declare member variables and methods for a singleton class.
JUCE Namespace.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88