File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ template <class To, class From> To cast(From value);
135
135
extern std::shared_ptr<plugin> GlobalPlugin;
136
136
137
137
// Performs PI one-time initialization.
138
- vector_class<plugin> initialize ();
138
+ const vector_class<plugin> & initialize ();
139
139
140
140
// Utility Functions to get Function Name for a PI Api.
141
141
template <PiApiKind PiApiOffset> struct PiFuncInfo {};
Original file line number Diff line number Diff line change @@ -255,7 +255,13 @@ bool trace(TraceLevel Level) {
255
255
}
256
256
257
257
// Initializes all available Plugins.
258
- vector_class<plugin> initialize () {
258
+ // The returned reference lifetime is through the end of the process.
259
+ //
260
+ // TODO: make sure that the global Plugins is destroyed last, at least
261
+ // after other tear-down relying on plugins (like destructors of global
262
+ // buffers) is completed.
263
+ //
264
+ const vector_class<plugin> &initialize () {
259
265
static bool PluginsInitDone = false ;
260
266
static vector_class<plugin> Plugins;
261
267
if (PluginsInitDone) {
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ static bool IsBannedPlatform(platform Platform) {
49
49
50
50
vector_class<platform> platform_impl::get_platforms () {
51
51
vector_class<platform> Platforms;
52
- vector_class<plugin> Plugins = RT::initialize ();
52
+ const vector_class<plugin> & Plugins = RT::initialize ();
53
53
54
54
info::device_type ForcedType = detail::get_forced_type ();
55
55
for (unsigned int i = 0 ; i < Plugins.size (); i++) {
You can’t perform that action at this time.
0 commit comments