| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | #if HAVE_CONFIG_H1 |
| 15 | #include "config.h" |
| 16 | #endif |
| 17 | |
| 18 | #include <pthread.h> |
| 19 | #include <errno(*__errno_location ()).h> |
| 20 | |
| 21 | #include <rtems/system.h> |
| 22 | #include <rtems/score/thread.h> |
| 23 | #include <rtems/posix/pthread.h> |
| 24 | |
| 25 | int pthread_join( |
| 26 | pthread_t thread, |
| 27 | void **value_ptr |
| 28 | ) |
| 29 | { |
| 30 | register Thread_Control *the_thread; |
| 31 | POSIX_API_Control *api; |
| 32 | Objects_Locations location; |
| 33 | void *return_pointer; |
| 1 | Variable 'return_pointer' declared without an initial value |
|
| 34 | |
| 35 | the_thread = _POSIX_Threads_Get( thread, &location ); |
| 36 | switch ( location ) { |
| 2 | Control jumps to 'case OBJECTS_LOCAL:' at line 38 |
|
| 37 | |
| 38 | case OBJECTS_LOCAL: |
| 39 | api = the_thread->API_Extensions[ THREAD_API_POSIX ]; |
| 40 | |
| 41 | if ( api->detachstate == PTHREAD_CREATE_DETACHEDPTHREAD_CREATE_DETACHED ) { |
| |
| 42 | _Thread_Enable_dispatch(); |
| 43 | return EINVAL22; |
| 44 | } |
| 45 | |
| 46 | if ( _Thread_Is_executing( the_thread ) ) { |
| |
| 47 | _Thread_Enable_dispatch(); |
| 48 | return EDEADLK35; |
| 49 | } |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | _Thread_Executing_Per_CPU_Information.executing->Wait.return_argument = &return_pointer; |
| 56 | |
| 57 | _Thread_queue_Enter_critical_section( &api->Join_List ); |
| 58 | |
| 59 | _Thread_queue_Enqueue( &api->Join_List, WATCHDOG_NO_TIMEOUT )_Thread_queue_Enqueue_with_handler( &api->Join_List, 0 , _Thread_queue_Timeout ); |
| 60 | |
| 61 | _Thread_Enable_dispatch(); |
| 62 | |
| 63 | if ( value_ptr ) |
| |
| 64 | *value_ptr = return_pointer; |
| 6 | Assigned value is garbage or undefined |
|
| 65 | return 0; |
| 66 | |
| 67 | #if defined(RTEMS_MULTIPROCESSING) |
| 68 | case OBJECTS_REMOTE: |
| 69 | #endif |
| 70 | case OBJECTS_ERROR: |
| 71 | break; |
| 72 | } |
| 73 | |
| 74 | return ESRCH3; |
| 75 | } |