source: rtems/cpukit/posix/src/pthreaddetach.c @ e633f3b

4.115
Last change on this file since e633f3b was e633f3b, checked in by Joel Sherrill <joel.sherrill@…>, on 01/31/14 at 17:03:24

posix/*.c: Remove use of register keyword

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 * @file
3 *
4 * @brief Detaching a Thread
5 * @ingroup POSIXAPI
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2014.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <pthread.h>
22#include <errno.h>
23
24#include <rtems/posix/pthreadimpl.h>
25#include <rtems/score/threadimpl.h>
26
27/**
28 * 16.1.4 Detaching a Thread, P1003.1c/Draft 10, p. 149
29 */
30int pthread_detach(
31  pthread_t   thread
32)
33{
34  Thread_Control          *the_thread;
35  POSIX_API_Control       *api;
36  Objects_Locations        location;
37
38  the_thread = _Thread_Get( thread, &location );
39  switch ( location ) {
40
41    case OBJECTS_LOCAL:
42
43      api = the_thread->API_Extensions[ THREAD_API_POSIX ];
44      api->detachstate = PTHREAD_CREATE_DETACHED;
45      _Objects_Put( &the_thread->Object );
46      return 0;
47
48#if defined(RTEMS_MULTIPROCESSING)
49    case OBJECTS_REMOTE:
50#endif
51    case OBJECTS_ERROR:
52      break;
53  }
54
55  return ESRCH;
56}
Note: See TracBrowser for help on using the repository browser.