mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Fatal parameter error when deleting/terminating Thread object
Call to osThreadTerminate is guarded by local_id check, to avoid parameter error fault when deleting or terminating Thread object that was not started.pull/5587/head
							parent
							
								
									4e222952d7
								
							
						
					
					
						commit
						c721ed8966
					
				| 
						 | 
				
			
			@ -129,7 +129,11 @@ osStatus Thread::terminate() {
 | 
			
		|||
    _tid = (osThreadId_t)NULL;
 | 
			
		||||
    if (!_finished) {
 | 
			
		||||
        _finished = true;
 | 
			
		||||
        ret = osThreadTerminate(local_id);
 | 
			
		||||
        // if local_id == 0 Thread was not started in first place
 | 
			
		||||
        // and does not have to be terminated
 | 
			
		||||
        if(local_id != 0) {
 | 
			
		||||
            ret = osThreadTerminate(local_id);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    _mutex.unlock();
 | 
			
		||||
    return ret;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue