thr_exit.c (17706) | thr_exit.c (22315) |
---|---|
1/* 2 * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 95 unchanged lines hidden (view full) --- 104 105 /* Block signals: */ 106 _thread_kern_sig_block(NULL); 107 108 /* Save the return value: */ 109 _thread_run->ret = status; 110 111 while (_thread_run->cleanup != NULL) { | 1/* 2 * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 95 unchanged lines hidden (view full) --- 104 105 /* Block signals: */ 106 _thread_kern_sig_block(NULL); 107 108 /* Save the return value: */ 109 _thread_run->ret = status; 110 111 while (_thread_run->cleanup != NULL) { |
112 _thread_cleanup_pop(1); | 112 pthread_cleanup_pop(1); |
113 } 114 115 if (_thread_run->attr.cleanup_attr != NULL) { 116 _thread_run->attr.cleanup_attr(_thread_run->attr.arg_attr); 117 } 118 /* Check if there is thread specific data: */ 119 if (_thread_run->specific_data != NULL) { 120 /* Run the thread-specific data destructors: */ 121 _thread_cleanupspecific(); 122 } 123 /* Check if there are any threads joined to this one: */ 124 while ((pthread = _thread_queue_deq(&(_thread_run->join_queue))) != NULL) { 125 /* Wake the joined thread and let it detach this thread: */ | 113 } 114 115 if (_thread_run->attr.cleanup_attr != NULL) { 116 _thread_run->attr.cleanup_attr(_thread_run->attr.arg_attr); 117 } 118 /* Check if there is thread specific data: */ 119 if (_thread_run->specific_data != NULL) { 120 /* Run the thread-specific data destructors: */ 121 _thread_cleanupspecific(); 122 } 123 /* Check if there are any threads joined to this one: */ 124 while ((pthread = _thread_queue_deq(&(_thread_run->join_queue))) != NULL) { 125 /* Wake the joined thread and let it detach this thread: */ |
126 pthread->state = PS_RUNNING; | 126 PTHREAD_NEW_STATE(pthread,PS_RUNNING); |
127 } 128 129 /* Check if the running thread is at the head of the linked list: */ 130 if (_thread_link_list == _thread_run) { 131 /* There is no previous thread: */ 132 _thread_link_list = _thread_run->nxt; 133 } else { 134 /* Point to the first thread in the list: */ --- 33 unchanged lines hidden (view full) --- 168 * now that this is known. 169 */ 170 break; 171 } 172 } 173 174 /* 175 * Check if the parent is not waiting on any other signal | 127 } 128 129 /* Check if the running thread is at the head of the linked list: */ 130 if (_thread_link_list == _thread_run) { 131 /* There is no previous thread: */ 132 _thread_link_list = _thread_run->nxt; 133 } else { 134 /* Point to the first thread in the list: */ --- 33 unchanged lines hidden (view full) --- 168 * now that this is known. 169 */ 170 break; 171 } 172 } 173 174 /* 175 * Check if the parent is not waiting on any other signal |
176 * handler threads: | 176 * handler threads and if it hasn't died in the meantime: |
177 */ | 177 */ |
178 if (pthread == NULL) { | 178 if (pthread == NULL && _thread_run->parent_thread->state != PS_DEAD) { |
179 /* Allow the parent thread to run again: */ | 179 /* Allow the parent thread to run again: */ |
180 _thread_run->parent_thread->state = PS_RUNNING; | 180 PTHREAD_NEW_STATE(_thread_run->parent_thread,PS_RUNNING); |
181 } 182 /* Get the signal number: */ 183 l = (long) _thread_run->arg; 184 sig = (int) l; 185 186 /* Unblock the signal from the parent thread: */ 187 sigdelset(&_thread_run->parent_thread->sigmask, sig); 188 } --- 17 unchanged lines hidden --- | 181 } 182 /* Get the signal number: */ 183 l = (long) _thread_run->arg; 184 sig = (int) l; 185 186 /* Unblock the signal from the parent thread: */ 187 sigdelset(&_thread_run->parent_thread->sigmask, sig); 188 } --- 17 unchanged lines hidden --- |