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

Method try_acquire_for

src/platforms/arm/stm32/semaphore_stm32.cpp.hpp:111–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109template<ptrdiff_t LeastMaxValue>
110template<class Rep, class Period>
111bool CountingSemaphoreSTM32<LeastMaxValue>::try_acquire_for(
112 const std::chrono::duration<Rep, Period>& rel_time) { // okay std namespace
113
114 if (mHandle == nullptr) {
115 return false;
116 }
117
118 // Convert duration to FreeRTOS ticks
119 auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(rel_time); // okay std namespace
120 TickType_t ticks = pdMS_TO_TICKS(ms.count());
121
122 SemaphoreHandle_t handle = static_cast<SemaphoreHandle_t>(mHandle);
123 BaseType_t result = xSemaphoreTake(handle, ticks);
124
125 return (result == pdTRUE);
126}
127
128template<ptrdiff_t LeastMaxValue>
129template<class Clock, class Duration>

Callers

nothing calls this directly

Calls 1

countMethod · 0.45

Tested by

no test coverage detected