Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/dmvfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "dmvfs.h"
#include <string.h>
#include <stdbool.h>
#include <errno.h>

typedef struct {
Dmod_Context_t* fs_context;
Expand Down Expand Up @@ -56,7 +57,18 @@ static inline bool lock_mutex(void)
}
if(g_mutex != NULL)
{
return (Dmod_Mutex_Lock(g_mutex) == 0);
int ret = Dmod_Mutex_Lock(g_mutex);
if (ret == 0)
{
return true;
}
else if (ret == -ENOTSUP)
{
/* RTOS has not started yet - fall back to critical sections */
Dmod_EnterCritical();
return true;
}
return false;
}
else
{
Expand All @@ -72,7 +84,12 @@ static inline void unlock_mutex(void)
{
if(g_mutex != NULL)
{
Dmod_Mutex_Unlock(g_mutex);
int ret = Dmod_Mutex_Unlock(g_mutex);
if (ret == -ENOTSUP)
{
/* RTOS has not started yet - we used critical sections for locking */
Dmod_ExitCritical();
}
}
else
{
Expand Down