2011-05-27 14:54:06 +00:00
|
|
|
#ifndef ENABLE_GC
|
2010-10-26 15:44:43 +00:00
|
|
|
#include "objc/toydispatch.h"
|
2010-11-02 16:27:00 +00:00
|
|
|
#include "lock.h"
|
2011-04-14 12:25:17 +00:00
|
|
|
#include "visibility.h"
|
2010-02-01 14:48:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
static dispatch_queue_t garbage_queue;
|
|
|
|
|
2011-04-14 12:25:17 +00:00
|
|
|
PRIVATE void objc_collect_garbage_data(void(*cleanup)(void*), void *garbage)
|
2010-02-01 14:48:40 +00:00
|
|
|
{
|
2010-11-02 16:27:00 +00:00
|
|
|
if (0 == garbage_queue)
|
|
|
|
{
|
2011-04-14 16:44:34 +00:00
|
|
|
LOCK_RUNTIME_FOR_SCOPE();
|
2010-11-02 16:27:00 +00:00
|
|
|
if (0 == garbage_queue)
|
|
|
|
{
|
|
|
|
garbage_queue = dispatch_queue_create("ObjC deferred free queue", 0);
|
|
|
|
}
|
|
|
|
}
|
2010-02-01 14:48:40 +00:00
|
|
|
dispatch_async_f(garbage_queue, garbage, cleanup);
|
|
|
|
}
|
2011-05-27 14:54:06 +00:00
|
|
|
|
|
|
|
#endif
|