mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Add some comments to the resource manager example for clarity.
This commit is contained in:
@@ -56,17 +56,26 @@ static ma_thread_result MA_THREADCALL custom_job_thread(void* pUserData)
|
|||||||
ma_result result;
|
ma_result result;
|
||||||
ma_job job;
|
ma_job job;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Retrieve a job from the queue first. This defines what it is you're about to do. By default this will be
|
||||||
|
blocking. You can initialize the resource manager with MA_RESOURCE_MANAGER_FLAG_NON_BLOCKING to not block in
|
||||||
|
which case MA_NO_DATA_AVAILABLE will be returned if no jobs are available.
|
||||||
|
*/
|
||||||
result = ma_resource_manager_next_job(pResourceManager, &job);
|
result = ma_resource_manager_next_job(pResourceManager, &job);
|
||||||
if (result != MA_SUCCESS) {
|
if (result != MA_SUCCESS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Terminate if we got a quit message. */
|
/*
|
||||||
|
Terminate if we got a quit message. You don't need to terminate like this, but's a bit more robust. You can
|
||||||
|
just use a global variable or something similar if it's easier for you particular situation.
|
||||||
|
*/
|
||||||
if (job.toc.code == MA_JOB_QUIT) {
|
if (job.toc.code == MA_JOB_QUIT) {
|
||||||
printf("CUSTOM JOB THREAD TERMINATING... ");
|
printf("CUSTOM JOB THREAD TERMINATING... ");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Call ma_resource_manager_process_job() to actually do the work to process the job. */
|
||||||
printf("PROCESSING IN CUSTOM JOB THREAD: %d\n", job.toc.code);
|
printf("PROCESSING IN CUSTOM JOB THREAD: %d\n", job.toc.code);
|
||||||
ma_resource_manager_process_job(pResourceManager, &job);
|
ma_resource_manager_process_job(pResourceManager, &job);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user