mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 07:23:34 +08:00
Fix STM32 F2/F4 SDIO clocking; Clean-up files in sched/ directory
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4940 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_mutexlock.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -72,35 +72,38 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_mutex_lock
|
||||
* Name: pthread_mutex_lock
|
||||
*
|
||||
* Description:
|
||||
* The mutex object referenced by mutex is locked by calling pthread_mutex_lock().
|
||||
* If the mutex is already locked, the calling thread blocks until the mutex
|
||||
* becomes available. This operation returns with the mutex object referenced
|
||||
* by mutex in the locked state with the calling thread as its owner.
|
||||
* The mutex object referenced by mutex is locked by calling
|
||||
* pthread_mutex_lock(). If the mutex is already locked, the calling thread
|
||||
* blocks until the mutex becomes available. This operation returns with the
|
||||
* mutex object referenced by mutex in the locked state with the calling
|
||||
* thread as its owner.
|
||||
*
|
||||
* If the mutex type is PTHREAD_MUTEX_NORMAL, deadlock detection is not provided.
|
||||
* Attempting to relock the mutex causes deadlock. If a thread attempts to unlock
|
||||
* a mutex that it has not locked or a mutex which is unlocked, undefined behavior
|
||||
* results.
|
||||
* If the mutex type is PTHREAD_MUTEX_NORMAL, deadlock detection is not
|
||||
* provided. Attempting to relock the mutex causes deadlock. If a thread
|
||||
* attempts to unlock a mutex that it has not locked or a mutex which is
|
||||
* unlocked, undefined behavior results.
|
||||
*
|
||||
* If the mutex type is PTHREAD_MUTEX_ERRORCHECK, then error checking is provided.
|
||||
* If a thread attempts to relock a mutex that it has already locked, an error
|
||||
* will be returned. If a thread attempts to unlock a mutex that it has not
|
||||
* locked or a mutex which is unlocked, an error will be returned.
|
||||
* If the mutex type is PTHREAD_MUTEX_ERRORCHECK, then error checking is
|
||||
* provided. If a thread attempts to relock a mutex that it has already
|
||||
* locked, an error will be returned. If a thread attempts to unlock a
|
||||
* mutex that it has not locked or a mutex which is unlocked, an error will
|
||||
* be returned.
|
||||
*
|
||||
* If the mutex type is PTHREAD_MUTEX_RECURSIVE, then the mutex maintains the concept
|
||||
* of a lock count. When a thread successfully acquires a mutex for the first time,
|
||||
* the lock count is set to one. Every time a thread relocks this mutex, the lock count
|
||||
* is incremented by one. Each time the thread unlocks the mutex, the lock count is
|
||||
* decremented by one. When the lock count reaches zero, the mutex becomes available
|
||||
* for other threads to acquire. If a thread attempts to unlock a mutex that it has
|
||||
* not locked or a mutex which is unlocked, an error will be returned.
|
||||
* If the mutex type is PTHREAD_MUTEX_RECURSIVE, then the mutex maintains
|
||||
* the concept of a lock count. When a thread successfully acquires a mutex
|
||||
* for the first time, the lock count is set to one. Every time a thread
|
||||
* relocks this mutex, the lock count is incremented by one. Each time the
|
||||
* thread unlocks the mutex, the lock count is decremented by one. When the
|
||||
* lock count reaches zero, the mutex becomes available for other threads to
|
||||
* acquire. If a thread attempts to unlock a mutex that it has not locked or
|
||||
* a mutex which is unlocked, an error will be returned.
|
||||
*
|
||||
* If a signal is delivered to a thread waiting for a mutex, upon return from
|
||||
* the signal handler the thread resumes waiting for the mutex as if it was
|
||||
* not interrupted.
|
||||
* If a signal is delivered to a thread waiting for a mutex, upon return
|
||||
* from the signal handler the thread resumes waiting for the mutex as if
|
||||
* it was not interrupted.
|
||||
*
|
||||
* Parameters:
|
||||
* mutex - A reference to the mutex to be locked.
|
||||
@@ -141,16 +144,16 @@ int pthread_mutex_lock(FAR pthread_mutex_t *mutex)
|
||||
#ifdef CONFIG_MUTEX_TYPES
|
||||
if (mutex->type == PTHREAD_MUTEX_RECURSIVE)
|
||||
{
|
||||
/* Yes... just increment the number of locks held and return success */
|
||||
|
||||
mutex->nlocks++;
|
||||
/* Yes... just increment the number of locks held and return success */
|
||||
|
||||
mutex->nlocks++;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* No, then we would deadlock... return an error (default behavior
|
||||
* is like PTHREAD_MUTEX_ERRORCHECK)
|
||||
*/
|
||||
/* No, then we would deadlock... return an error (default behavior
|
||||
* is like PTHREAD_MUTEX_ERRORCHECK)
|
||||
*/
|
||||
|
||||
sdbg("Returning EDEADLK\n");
|
||||
ret = EDEADLK;
|
||||
@@ -174,6 +177,7 @@ int pthread_mutex_lock(FAR pthread_mutex_t *mutex)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user