Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Semaphore.cpp
00001 #include "Semaphore.h" 00002 00003 #include <string.h> 00004 #include "error.h" 00005 00006 namespace rtos { 00007 00008 Semaphore::Semaphore (int32_t count) { 00009 #ifdef CMSIS_OS_RTX 00010 memset(_semaphore_data, 0, sizeof(_semaphore_data)); 00011 _osSemaphoreDef.semaphore = _semaphore_data; 00012 #endif 00013 _osSemaphoreId = osSemaphoreCreate(&_osSemaphoreDef, count); 00014 } 00015 00016 int32_t Semaphore::wait (uint32_t millisec) { 00017 return osSemaphoreWait(_osSemaphoreId, millisec); 00018 } 00019 00020 osStatus Semaphore::release (void) { 00021 return osSemaphoreRelease(_osSemaphoreId); 00022 } 00023 00024 Semaphore::~Semaphore() { 00025 osSemaphoreDelete(_osSemaphoreId); 00026 } 00027 00028 }
Generated on Tue Jul 12 2022 12:34:51 by
1.7.2