source: rtems/cpukit/posix/src/mutexattrsettype.c @ 8cdf733

4.104.115
Last change on this file since 8cdf733 was 8cdf733, checked in by Joel Sherrill <joel.sherrill@…>, on 07/06/09 at 14:46:36

2009-07-06 Joel Sherrill <joel.sherrill@…>

  • posix/Makefile.am, posix/src/mutex.c, posix/src/mutexinit.c: Add initial support for the pthread mutex type attribute added by UNIX98. It can be normal, recursive, errorcheck or default.
  • posix/src/mutexattrgettype.c, posix/src/mutexattrsettype.c: New files.
  • Property mode set to 100644
File size: 980 bytes
Line 
1/*
2 *  COPYRIGHT (c) 1989-2009.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <errno.h>
17#include <pthread.h>
18
19#include <rtems/system.h>
20#include <rtems/score/coremutex.h>
21#include <rtems/score/watchdog.h>
22#include <rtems/posix/mutex.h>
23#include <rtems/posix/priority.h>
24#include <rtems/posix/time.h>
25
26#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES)
27int pthread_mutexattr_settype(
28  pthread_mutexattr_t *attr,
29  int                  type
30)
31{
32  if ( !attr || !attr->is_initialized )
33    return EINVAL;
34
35  switch ( type ) {
36    case PTHREAD_MUTEX_NORMAL:
37    case PTHREAD_MUTEX_RECURSIVE:
38    case PTHREAD_MUTEX_ERRORCHECK:
39    case PTHREAD_MUTEX_DEFAULT:
40      attr->type = type;
41      return 0;
42
43    default:
44      return EINVAL;
45  }
46}
47#endif
Note: See TracBrowser for help on using the repository browser.