Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
2a15044f
Commit
2a15044f
authored
Jul 25, 2020
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update resource_manager example.
parent
3df4a9e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
research/_examples/resource_manager.c
research/_examples/resource_manager.c
+15
-1
No files found.
research/_examples/resource_manager.c
View file @
2a15044f
...
...
@@ -60,9 +60,19 @@ static ma_thread_result MA_THREADCALL custom_job_thread(void* pUserData)
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.
When the quit job is returned (MA_JOB_QUIT), the return value will always be MA_CANCELLED. If you don't want
to check the return value (you should), you can instead check if the job code is MA_JOB_QUIT and use that
instead.
*/
result
=
ma_resource_manager_next_job
(
pResourceManager
,
&
job
);
if
(
result
!=
MA_SUCCESS
)
{
if
(
result
==
MA_CANCELLED
)
{
printf
(
"CUSTOM JOB THREAD TERMINATING VIA MA_CANCELLED... "
);
}
else
{
printf
(
"CUSTOM JOB THREAD ERROR: %s. TERMINATING... "
,
ma_result_description
(
result
));
}
break
;
}
...
...
@@ -71,9 +81,13 @@ static ma_thread_result MA_THREADCALL custom_job_thread(void* pUserData)
just use a global variable or something similar if it's easier for you particular situation. The quit job
remains in the queue and will continue to be returned by future calls to ma_resource_manager_next_job(). The
reason for this is to give every job thread visibility to the quit job so they have a chance to exit.
We won't actually be hitting this code because the call above will return MA_CANCELLED when the MA_JOB_QUIT
event is received which means the `result != MA_SUCCESS` logic above will catch it. If you do not check the
return value of ma_resource_manager_next_job() you will want to check for MA_JOB_QUIT like the code below.
*/
if
(
job
.
toc
.
code
==
MA_JOB_QUIT
)
{
printf
(
"CUSTOM JOB THREAD TERMINATING... "
);
printf
(
"CUSTOM JOB THREAD TERMINATING
VIA MA_JOB_QUIT
... "
);
break
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment