source: rtems/cpukit/posix/src/mutexsetprioceiling.c @ 8da6d77d

4.104.114.9
Last change on this file since 8da6d77d was b8596d8, checked in by Joel Sherrill <joel.sherrill@…>, on Nov 28, 2007 at 6:35:31 PM

2007-11-28 Joel Sherrill <joel.sherrill@…>

  • posix/Makefile.am, posix/preinstall.am, posix/src/cancel.c, posix/src/conddestroy.c, posix/src/condinit.c, posix/src/condsignalsupp.c, posix/src/condwaitsupp.c, posix/src/mqueueclose.c, posix/src/mqueuecreatesupp.c, posix/src/mqueuedeletesupp.c, posix/src/mqueuegetattr.c, posix/src/mqueuenotify.c, posix/src/mqueuerecvsupp.c, posix/src/mqueuesendsupp.c, posix/src/mqueuesetattr.c, posix/src/mqueueunlink.c, posix/src/mutexattrdestroy.c, posix/src/mutexattrgetprioceiling.c, posix/src/mutexattrgetprotocol.c, posix/src/mutexattrgetpshared.c, posix/src/mutexattrinit.c, posix/src/mutexattrsetprioceiling.c, posix/src/mutexattrsetprotocol.c, posix/src/mutexattrsetpshared.c, posix/src/mutexdefaultattributes.c, posix/src/mutexdestroy.c, posix/src/mutexgetprioceiling.c, posix/src/mutexinit.c, posix/src/mutexlocksupp.c, posix/src/mutexsetprioceiling.c, posix/src/mutexunlock.c, posix/src/semaphorecreatesupp.c, posix/src/semaphoredeletesupp.c, posix/src/semaphorewaitsupp.c, posix/src/semclose.c, posix/src/semdestroy.c, posix/src/semgetvalue.c, posix/src/sempost.c, posix/src/semunlink.c, posix/src/types.c, score/cpu/powerpc/rtems/old-exceptions/cpu.h: Remove all pretense of POSIX MP support. The support in place was only a shell. This should make maintenance easier.
  • posix/include/rtems/posix/condmp.h, posix/include/rtems/posix/mqueuemp.h, posix/include/rtems/posix/mutexmp.h, posix/include/rtems/posix/pthreadmp.h, posix/include/rtems/posix/semaphoremp.h, posix/src/condmp.c, posix/src/mutexmp.c, posix/src/semaphoremp.c: Removed.
  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 *  $Id$
3 */
4
5#if HAVE_CONFIG_H
6#include "config.h"
7#endif
8
9#include <errno.h>
10#include <pthread.h>
11
12#include <rtems/system.h>
13#include <rtems/score/coremutex.h>
14#include <rtems/score/watchdog.h>
15#if defined(RTEMS_MULTIPROCESSING)
16#include <rtems/score/mpci.h>
17#endif
18#include <rtems/posix/mutex.h>
19#include <rtems/posix/priority.h>
20#include <rtems/posix/time.h>
21
22/*PAGE
23 *
24 *  13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
25 */
26
27int pthread_mutex_setprioceiling(
28  pthread_mutex_t   *mutex,
29  int                prioceiling,
30  int               *old_ceiling
31)
32{
33  register POSIX_Mutex_Control *the_mutex;
34  Objects_Locations             location;
35  Priority_Control              the_priority;
36  int                           status;
37
38  if ( !old_ceiling )
39    return EINVAL;
40
41  if ( !_POSIX_Priority_Is_valid( prioceiling ) )
42    return EINVAL;
43
44  the_priority = _POSIX_Priority_To_core( prioceiling );
45
46  /*
47   *  Must acquire the mutex before we can change it's ceiling
48   */
49
50  status = pthread_mutex_lock( mutex );
51  if ( status )
52    return status;
53
54  the_mutex = _POSIX_Mutex_Get( mutex, &location );
55  switch ( location ) {
56#if defined(RTEMS_MULTIPROCESSING)
57    case OBJECTS_REMOTE:
58#endif
59    case OBJECTS_ERROR:
60      return EINVAL;        /* impossible to get here */
61    case OBJECTS_LOCAL:
62      *old_ceiling = _POSIX_Priority_From_core(
63        the_mutex->Mutex.Attributes.priority_ceiling
64      );
65      the_mutex->Mutex.Attributes.priority_ceiling = the_priority;
66      _CORE_mutex_Surrender(
67        &the_mutex->Mutex,
68        the_mutex->Object.id,
69#if defined(RTEMS_MULTIPROCESSING)
70        _POSIX_Threads_mutex_MP_support
71#else
72        NULL
73#endif
74      );
75      _Thread_Enable_dispatch();
76      return 0;
77  }
78  return POSIX_BOTTOM_REACHED();
79}
Note: See TracBrowser for help on using the repository browser.