Changeset 649 for cpp/common/threads.h


Ignore:
Timestamp:
02/02/17 15:13:39 (5 years ago)
Author:
Maciej Komosinski
Message:

Display diagnostic message when threads not released properly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/threads.h

    r377 r649  
    2525{
    2626        pthread_key_t mt_key;
    27 
     27        bool destroyed;
     28       
    2829public:
    2930
     
    3132        {
    3233                pthread_key_create(&mt_key, &destructor);
     34                destroyed=false;
    3335        }
    3436
     
    3739                T* o = set(NULL);
    3840                if (o) delete o;
     41                destroyed=true;
    3942        }
    4043
     
    5457        T* get()
    5558        {
     59                if (destroyed) { printf("Fatal Error: accessing ThreadSingleton after destroying it\n"); return NULL; } // this will never happen
    5660                T* o = (T*)pthread_getspecific(mt_key);
    5761                if (!o)
Note: See TracChangeset for help on using the changeset viewer.