Multiply-thread create model from file get error

I want to call SketchUp C API to load model from file. But I hava many models will be loaded, so I use cpp multiply-thread to called SketchUP API use this method: SUModelCreateFromFileWithStatus, you can find the method doc from here. I create a thread for each file load, but the SketchUp API give me a error: throw CArchiveException: 5 。But if I add a cpp lock let all threads to serial execute SUModelCreateFromFileWithStatus method, everything is OK, but use this way is a little low effective. If I want to use more effective ways to load model from path, such as use multiply-thread to call SUModelCreateFromFileWithStatus, how to fix my code to let program run right and more effective? or the API don’t support multiply-thread call at all?

My OS is:Windows10, CPU is Intel i7-10510U 8cores

Flowing is part code of my program, each thread will call this method, but get a error:throw CArchiveException: 5.

int Model_Write(const char* filepath, SUTypedValueRef modelIDTPRef, SUTypedValueRef modelVersionTPRef, int save_version_name)
{
	//std::lock_guard<std::mutex> mid_lock(mid_mutex); // add this code everything is OK, but is a little low effective, otherwise, api throw a error: CArchiveException: 5.
	LOG(INFO) << "[Thread-" << thread_index << "]: " << "[model write] [...]";
	auto begin = getCurrentMilliseconds();
	SUModelRef model = SU_INVALID;
	SUModelLoadStatus status;
	SUResult res = SU_ERROR_NONE;
	SUInitialize();
	res = SUModelCreateFromFileWithStatus(&model, filepath, &status);
	if (res != SU_ERROR_NONE) {
		LOG(ERROR) << "[Thread-" << thread_index << "]: " << "[model write] [failure] load model failure, error code is: " << res;
		return -1;
	}
	LOG(INFO) << "[Thread-" << thread_index << "]: " << " [model write] [...] open success: " << filepath;
}

Please move this topic to the SDK subcategory.

OK, I will do this now

Just edit the topic title and choose the SDK category from the dropdown.