[8328] Fixed problem with crash at startup in result destroy anti-freeze thread runnable.

* Destroy runnable only if no references.
* Some code cleanups
This commit is contained in:
VladimirMangos 2009-08-08 09:35:59 +04:00
parent 79c1324bed
commit 7baebcd2de
5 changed files with 50 additions and 18 deletions

View file

@ -21,6 +21,7 @@
#include <ace/Thread.h>
#include <ace/TSS_T.h>
#include "ace/Atomic_Op.h"
#include <assert.h>
#include "Errors.h"
@ -32,6 +33,15 @@ namespace ACE_Based
public:
virtual ~Runnable() {}
virtual void run() = 0;
void incReference() { ++m_refs; }
void decReference()
{
if(!--m_refs)
delete this;
}
private:
ACE_Atomic_Op<ACE_Thread_Mutex, int> m_refs;
};
enum Priority