MCPcopy Create free account
hub / github.com/FastLED/FastLED / getOrCreate

Method getOrCreate

src/fl/audio/audio.cpp.hpp:48–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 impl.reset();
47 }
48 SampleImplPtr getOrCreate() {
49 {
50 fl::unique_lock<fl::mutex> lock(mutex);
51 if (!pool.empty()) {
52 SampleImplPtr impl = pool.back();
53 pool.pop_back();
54 return impl;
55 }
56 }
57 return fl::make_shared<SampleImpl>();
58 }
59
60 fl::vector<SampleImplPtr> pool;
61 static constexpr fl::size MAX_POOL_SIZE = 8;

Callers 1

SampleMethod · 0.45

Calls 3

emptyMethod · 0.45
backMethod · 0.45
pop_backMethod · 0.45

Tested by

no test coverage detected