rtems: Use once mutex for timer server init

This commit is contained in:
Sebastian Huber
2015-05-19 12:00:43 +02:00
parent a382010c62
commit d5a9c808f0
+3 -2
View File
@@ -29,6 +29,7 @@
#include <rtems.h>
#include <rtems/rtems/timerimpl.h>
#include <rtems/rtems/tasksimpl.h>
#include <rtems/score/apimutex.h>
#include <rtems/score/todimpl.h>
static Timer_server_Control _Timer_server_Default;
@@ -346,10 +347,10 @@ rtems_status_code rtems_timer_initiate_server(
/*
* Just to make sure this is only called once.
*/
_Thread_Disable_dispatch();
_Once_Lock();
tmpInitialized = initialized;
initialized = true;
_Thread_Enable_dispatch();
_Once_Unlock();
if ( tmpInitialized )
return RTEMS_INCORRECT_STATE;