First thing we need to do is check whether or not the data buffer is getting deleted. If so we
just abort, but making sure we increment the execution pointer.
*/
if (ma_resource_manager_data_buffer_result(pJob->data.loadDataBuffer.pDataBuffer) != MA_BUSY) {
result = ma_resource_manager_data_buffer_result(pJob->data.loadDataBuffer.pDataBuffer); /* The data buffer may be getting deleted before it's even been loaded. */
goto done;
result = ma_resource_manager_data_buffer_result(pJob->data.loadDataBuffer.pDataBuffer);
if (result != MA_BUSY) {
goto done; /* <-- This will ensure the exucution pointer is incremented. */
} else {
result = MA_SUCCESS; /* <-- Make sure this is reset. */
}
/* Try initializing the connector if we haven't already. */
if (pJob->data.loadDataBuffer.pDataBuffer->isConnectorInitialized == MA_FALSE) {
if (ma_resource_manager_data_buffer_node_get_data_supply_type(pJob->data.loadDataBuffer.pDataBuffer->pNode) != ma_resource_manager_data_supply_type_unknown) {
if (dataSupplyType != ma_resource_manager_data_supply_type_unknown) {
/* We can now initialize the connector. If this fails, we need to abort. It's very rare for this to fail. */
result = ma_resource_manager_data_buffer_init_connector(pJob->data.loadDataBuffer.pDataBuffer, pJob->data.loadDataBuffer.pInitNotification, pJob->data.loadDataBuffer.pInitFence);
if (result != MA_SUCCESS) {
ma_log_postf(ma_resource_manager_get_log(pResourceManager), MA_LOG_LEVEL_ERROR, "Failed to initialize connector for data buffer. %s.\n", ma_result_description(result));
goto done;
}
} else {
/* Don't have a known data supply type. Most likely the data buffer node is still loading, but it could be that an error occurred. */
}
} else {
/* The connector is already initialized. Nothing to do here. */