From 905d7fa3a283d75969373783feeeff331157304e Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 24 Apr 2018 15:23:39 +0200 Subject: drvmgr: Use API mutex usage The driver manager lock may be used before the executing thread is initialized. --- cpukit/libdrvmgr/drvmgr_lock.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'cpukit/libdrvmgr') diff --git a/cpukit/libdrvmgr/drvmgr_lock.c b/cpukit/libdrvmgr/drvmgr_lock.c index c7a1104eef..23cdb137e6 100644 --- a/cpukit/libdrvmgr/drvmgr_lock.c +++ b/cpukit/libdrvmgr/drvmgr_lock.c @@ -7,16 +7,20 @@ * http://www.rtems.org/license/LICENSE. */ -#include #include #include "drvmgr_internal.h" +#include -void _DRV_Manager_Lock(void) +void _DRV_Manager_Lock( void ) { - _API_Mutex_Lock(&drvmgr.lock); + if ( !_System_state_Is_before_multitasking( _System_state_Get() ) ) { + _API_Mutex_Lock( &drvmgr.lock ); + } } void _DRV_Manager_Unlock(void) { - _API_Mutex_Unlock(&drvmgr.lock); + if ( !_System_state_Is_before_multitasking( _System_state_Get() ) ) { + _API_Mutex_Unlock( &drvmgr.lock ); + } } -- cgit v1.2.3