aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/basetypes/MCAutoreleasePool.h
blob: 583015c9aee26a86bdccef73e624db906d79ca5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef __MAILCORE_MCAUTORELEASEPOOL_H_

#define __MAILCORE_MCAUTORELEASEPOOL_H_

#include <mailcore/MCObject.h>
#include <libetpan/libetpan.h>
#include <pthread.h>

#ifdef __cplusplus

namespace mailcore {

	class AutoreleasePool : public Object {
	public:
		AutoreleasePool();
		virtual ~AutoreleasePool();
		
		static void autorelease(Object * obj);
        
    public: // subclass behavior
		virtual String * description();
        
	private:
		static void init();
		static pthread_key_t autoreleasePoolStackKey;
		carray * mPoolObjects;
		static carray * createAutoreleasePoolStackIfNeeded();
		static void destroyAutoreleasePoolStack(void *);
		static void initAutoreleasePoolStackKey();
		static AutoreleasePool * currentAutoreleasePool();
		virtual void add(Object * obj);
	};

}

#endif

#endif