31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#define get_tls(t) TlsGetValue(t)
#define set_tls(t, v) TlsSetValue(t, v)
static DWORD pool_list_key;
#endif
#ifndef _WIN32
static void
release_obj(void *obj)
{
[(OFObject*)obj release];
}
#endif
@implementation OFAutoreleasePool
+ (void)initialize
{
#ifndef _WIN32
if (pthread_key_create(&pool_list_key, release_obj))
@throw [OFInitializationFailedException newWithClass: self];
#else
/* FIXME: Free stuff when thread is terminated! */
if ((pool_list_key = TlsAlloc()) == TLS_OUT_OF_INDEXES)
@throw [OFInitializationFailedException newWithClass: self];
#endif
}
|
>
>
>
|
|
>
>
>
>
>
>
|
|
|
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#define get_tls(t) TlsGetValue(t)
#define set_tls(t, v) TlsSetValue(t, v)
static DWORD pool_list_key;
#endif
#ifndef _WIN32
static void
release_list(void *list)
{
of_list_object_t *first, *iter;
IMP release;
if ((first = [(OFList*)list first]) != NULL)
release = [first->object methodFor: @selector(release)];
for (iter = first; iter != NULL; iter = iter->next)
release(iter->object, @selector(release));
[(OFList*)list release];
}
#endif
@implementation OFAutoreleasePool
+ (void)initialize
{
#ifndef _WIN32
if (pthread_key_create(&pool_list_key, release_list))
@throw [OFInitializationFailedException newWithClass: self];
#else
/* FIXME: Free stuff when thread is terminated! */
if ((pool_list_key = TlsAlloc()) == TLS_OUT_OF_INDEXES)
@throw [OFInitializationFailedException newWithClass: self];
#endif
}
|