Projektarbeit Line Following Robot bei Prof. Chowanetz im WS22/23
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vcos_reentrant_mutex.h 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. Copyright (c) 2012, Broadcom Europe Ltd
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are met:
  6. * Redistributions of source code must retain the above copyright
  7. notice, this list of conditions and the following disclaimer.
  8. * Redistributions in binary form must reproduce the above copyright
  9. notice, this list of conditions and the following disclaimer in the
  10. documentation and/or other materials provided with the distribution.
  11. * Neither the name of the copyright holder nor the
  12. names of its contributors may be used to endorse or promote products
  13. derived from this software without specific prior written permission.
  14. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  15. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  16. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
  18. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  19. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  20. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  21. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  23. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. /*=============================================================================
  26. VideoCore OS Abstraction Layer - reentrant mutex public header file
  27. =============================================================================*/
  28. #ifndef VCOS_REENTRANT_MUTEX_H
  29. #define VCOS_REENTRANT_MUTEX_H
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #include "vcos_types.h"
  34. #include "pthreads/vcos_platform.h"
  35. /**
  36. * \file
  37. *
  38. * Reentrant Mutex API. You can take one of these mutexes even if you've already
  39. * taken it. Just to make sure.
  40. *
  41. * A re-entrant mutex may be slower on some platforms than a regular one.
  42. *
  43. * \sa vcos_mutex.h
  44. *
  45. */
  46. /** Create a mutex.
  47. *
  48. * @param m Filled in with mutex on return
  49. * @param name A non-null name for the mutex, used for diagnostics.
  50. *
  51. * @return VCOS_SUCCESS if mutex was created, or error code.
  52. */
  53. VCOS_INLINE_DECL
  54. VCOS_STATUS_T vcos_reentrant_mutex_create(VCOS_REENTRANT_MUTEX_T *m, const char *name);
  55. /** Delete the mutex.
  56. */
  57. VCOS_INLINE_DECL
  58. void vcos_reentrant_mutex_delete(VCOS_REENTRANT_MUTEX_T *m);
  59. /** Wait to claim the mutex. Must not have already been claimed by the current thread.
  60. */
  61. #ifndef vcos_reentrant_mutexlock
  62. VCOS_INLINE_DECL
  63. void vcos_reentrant_mutex_lock(VCOS_REENTRANT_MUTEX_T *m);
  64. /** Release the mutex.
  65. */
  66. VCOS_INLINE_DECL
  67. void vcos_reentrant_mutex_unlock(VCOS_REENTRANT_MUTEX_T *m);
  68. #endif
  69. #ifdef __cplusplus
  70. }
  71. #endif
  72. #endif