You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
415 B
C

#include "objc/toydispatch.h"
#include "lock.h"
static dispatch_queue_t garbage_queue;
void objc_collect_garbage_data(void(*cleanup)(void*), void *garbage)
{
if (0 == garbage_queue)
{
LOCK(__objc_runtime_mutex);
if (0 == garbage_queue)
{
garbage_queue = dispatch_queue_create("ObjC deferred free queue", 0);
}
UNLOCK(__objc_runtime_mutex);
}
dispatch_async_f(garbage_queue, garbage, cleanup);
}