-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor OS::Mutex in CMake selection #2790
base: devel
Are you sure you want to change the base?
Conversation
delete reinterpret_cast<pthread_mutex_t*>(this->m_handle); | ||
} | ||
PosixMutex::Status PosixMutex::release() { | ||
PlatformIntType status = pthread_mutex_unlock(&this->m_handle.m_mutex_descriptor); |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
this->m_handle = reinterpret_cast<POINTER_CAST>(handle); | ||
} | ||
PosixMutex::Status PosixMutex::take() { | ||
PlatformIntType status = pthread_mutex_lock(&this->m_handle.m_mutex_descriptor); |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
stat = pthread_mutex_init(handle,&attr); | ||
FW_ASSERT(stat == 0,stat); | ||
PosixMutex::~PosixMutex() { | ||
PlatformIntType status = pthread_mutex_destroy(&this->m_handle.m_mutex_descriptor); |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
pthread_mutexattr_t attr; | ||
pthread_mutexattr_init(&attr); | ||
// set to normal mutex type | ||
PlatformIntType status = pthread_mutexattr_settype(&attribute, PTHREAD_MUTEX_NORMAL); |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
@@ -70,5 +70,23 @@ | |||
return status; | |||
} | |||
|
|||
Mutex::Status posix_status_to_mutex_status(PlatformIntType posix_status){ |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
Status release() override; //!< unlock the mutex and get return status | ||
void lock() override; //!< lock the mutex | ||
void unLock() override; //!< unlock the mutex | ||
void unlock() { this->unLock(); } //!< alias for unLock to meet BasicLockable requirements |
Check notice
Code scanning / CodeQL
More than one statement per line Note
void unLock(); //!< unlock the mutex | ||
void unlock() { this->unLock(); } //!< alias for unLock to meet BasicLockable requirements | ||
//! \brief default constructor | ||
MutexInterface() = default; |
Check notice
Code scanning / CodeQL
More than one statement per line Note
namespace Posix { | ||
namespace Mutex { | ||
|
||
struct PosixMutexHandle : public MutexHandle { |
Check notice
Code scanning / CodeQL
More than one statement per line Note
@@ -70,5 +70,23 @@ | |||
return status; | |||
} | |||
|
|||
Mutex::Status posix_status_to_mutex_status(PlatformIntType posix_status){ |
Check notice
Code scanning / CodeQL
Long function without assertion Note
@@ -70,5 +70,23 @@ | |||
return status; | |||
} | |||
|
|||
Mutex::Status posix_status_to_mutex_status(PlatformIntType posix_status){ | |||
Mutex::Status status = Mutex::Status::ERROR_OTHER; | |||
switch (posix_status) { |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
PosixMutex::PosixMutex() : Os::MutexInterface(), m_handle() { | ||
// set attributes | ||
pthread_mutexattr_t attribute; | ||
pthread_mutexattr_init(&attribute); |
Check warning
Code scanning / CodeQL
Unchecked return value Warning
Change Description
Refactor the Mutex part of the OSAL layer to use the new system!
Rationale
See #2722
WIP
Still polishing a few things, opening this as a draft to see how CI behaves