Thomas
10/08/2019, 6:11 PMplatform.darwin.DISPATCH_DATA_DESTRUCTOR_DEFAULT
not appear as a dispatch_block_t
? Just like DISPATCH_DATA_DESTRUCTOR_FREE
, which does appear to be correct. Instead of dispatch_block_t
it appears as kotlinx.cinterop.COpaquePointer?
. I have no idea how I can use that as a dispatch block.Thomas
10/08/2019, 6:13 PMolonho
10/08/2019, 7:32 PMNULL
, thus isn’t valid function pointerThomas
10/08/2019, 7:34 PMThomas
10/08/2019, 7:35 PMprivate fun ByteArray.toDispatchData(): dispatch_data_t = usePinned { pinned ->
dispatch_data_create(
buffer = pinned.addressOf(0),
size = size.convert(),
queue = dispatch_get_main_queue(),
destructor = TODO()
)
}
So can I just use null for the destructor? Or would that cause memory leaks?Thomas
10/08/2019, 7:38 PMDISPATCH_DATA_DESTRUCTOR_DEFAULT
because the docs say:
If you specify the default destructor using the DISPATCH_DATA_DESTRUCTOR_DEFAULT constant, this function creates a copy of the data in buffer and manages that data internally.
olonho
10/09/2019, 6:11 AMThomas
10/09/2019, 8:32 PM