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

Method put

src/fl/audio/audio.cpp.hpp:34–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33struct AudioSamplePool {
34 void put(SampleImplPtr&& impl) {
35 if (impl.unique()) {
36 // There is no more shared_ptr to this object, so we can recycle it.
37 fl::unique_lock<fl::mutex> lock(mutex);
38 if (impl && pool.size() < MAX_POOL_SIZE) {
39 // Reset the impl for reuse (clear internal state)
40 impl->reset();
41 pool.push_back(impl);
42 return;
43 }
44 }
45 // Pool is full, discard the impl
46 impl.reset();
47 }
48 SampleImplPtr getOrCreate() {
49 {
50 fl::unique_lock<fl::mutex> lock(mutex);

Callers 1

audio.cpp.hppFile · 0.45

Calls 4

uniqueMethod · 0.45
sizeMethod · 0.45
resetMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected