source: rtems/cpukit/posix/src/pthreaddetach.c @ 843bfe5

4.9
Last change on this file since 843bfe5 was 843bfe5, checked in by Joel Sherrill <joel.sherrill@…>, on 03/08/11 at 22:15:07

2011-03-08 Joel Sherrill <joel.sherrilL@…>

PR 1759/cpukit

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