Changeset 63:b73e50c3772b in finroc_plugins_scheduling


Ignore:
Timestamp:
30.03.2021 00:54:37 (3 weeks ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
17.03
Phase:
public
Tags:
tip
Message:

Fixes issue when deleting thread containers at runtime - ensuring threads are always stopped/joined before doing so

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tThreadContainerBase.cpp

    r60 r63  
    7070// Implementation 
    7171//---------------------------------------------------------------------- 
     72 
     73namespace 
     74{ 
     75 
     76class tThreadContainerAnnotation : public core::tAnnotation 
     77{ 
     78public: 
     79 
     80  tThreadContainerAnnotation(tThreadContainerBase& thread_container) : 
     81    thread_container(thread_container) 
     82  {} 
     83 
     84  virtual void OnManagedDelete() override 
     85  { 
     86    if (thread_container.IsExecuting()) 
     87    { 
     88      thread_container.PauseExecution(); 
     89    } 
     90  } 
     91 
     92  tThreadContainerBase& thread_container; 
     93}; 
     94 
     95} 
    7296 
    7397//---------------------------------------------------------------------- 
     
    93117 
    94118  component->AddAnnotation(*new tExecutionControl(*this)); 
     119  component->EmplaceAnnotation<tThreadContainerAnnotation>(*this); 
    95120} 
    96121 
Note: See TracChangeset for help on using the changeset viewer.