mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[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:
parent
79c1324bed
commit
7baebcd2de
5 changed files with 50 additions and 18 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue