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
d91ca8e8
Commit
d91ca8e8
authored
Aug 08, 2020
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resource Manager: Cleanup from some previous refactoring.
parent
0cbd8c2c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
147 additions
and
165 deletions
+147
-165
research/ma_engine.h
research/ma_engine.h
+147
-165
No files found.
research/ma_engine.h
View file @
d91ca8e8
...
@@ -2052,7 +2052,7 @@ static ma_data_source* ma_resource_manager_data_buffer_get_connector(ma_resource
...
@@ -2052,7 +2052,7 @@ static ma_data_source* ma_resource_manager_data_buffer_get_connector(ma_resource
}
}
}
}
static
ma_result
ma_resource_manager_data_buffer_init_nolock
(
ma_resource_manager
*
pResourceManager
,
const
char
*
pFilePath
,
ma_uint32
hashedName32
,
ma_uint32
flags
,
ma_
resource_manager_memory_buffer
*
pExistingData
,
ma_
async_notification
*
pNotification
,
ma_resource_manager_data_buffer
*
pDataBuffer
)
static
ma_result
ma_resource_manager_data_buffer_init_nolock
(
ma_resource_manager
*
pResourceManager
,
const
char
*
pFilePath
,
ma_uint32
hashedName32
,
ma_uint32
flags
,
ma_async_notification
*
pNotification
,
ma_resource_manager_data_buffer
*
pDataBuffer
)
{
{
ma_result
result
;
ma_result
result
;
ma_resource_manager_data_buffer_node
*
pInsertPoint
;
ma_resource_manager_data_buffer_node
*
pInsertPoint
;
...
@@ -2123,27 +2123,10 @@ static ma_result ma_resource_manager_data_buffer_init_nolock(ma_resource_manager
...
@@ -2123,27 +2123,10 @@ static ma_result ma_resource_manager_data_buffer_init_nolock(ma_resource_manager
}
}
/*
/*
The new data buffer has been inserted into the BST. If the data for the item is owned by the application we don't need to do anything except
The new data buffer has been inserted into the BST. We now need to load the data. If we are loading synchronously we need to load
set the necessary data pointers. Otherwise we need to load the data. If we are loading synchronously we need to load everything from the
everything from the calling thread because we may be in a situation where there are no job threads running and therefore the data
calling thread because we may be in a situation where there are no job threads running and therefore the data will never get loaded. If we
will never get loaded. If we are loading asynchronously, we can assume at least one job thread exists and we can do everything
are loading asynchronously, we can assume at least one job thread exists and we can do everything from there.
from there.
*/
if
(
pExistingData
!=
NULL
)
{
/* We don't need to do anything if the data is owned by the application except set the necessary data pointers. */
MA_ASSERT
(
dataBufferType
==
pExistingData
->
type
);
pDataBuffer
->
pNode
->
isDataOwnedByResourceManager
=
MA_FALSE
;
pDataBuffer
->
pNode
->
data
=
*
pExistingData
;
pDataBuffer
->
pNode
->
result
=
MA_SUCCESS
;
/* Fire the event if we have one. */
if
(
pNotification
!=
NULL
)
{
ma_async_notification_signal
(
pNotification
);
}
}
else
{
/*
The data needs to be loaded. If we're loading synchronously we need to do everything here on the calling thread. Otherwise we post
a job and get one of the job threads to do it for us.
*/
*/
pDataBuffer
->
pNode
->
isDataOwnedByResourceManager
=
MA_TRUE
;
pDataBuffer
->
pNode
->
isDataOwnedByResourceManager
=
MA_TRUE
;
pDataBuffer
->
pNode
->
result
=
MA_BUSY
;
pDataBuffer
->
pNode
->
result
=
MA_BUSY
;
...
@@ -2315,7 +2298,6 @@ static ma_result ma_resource_manager_data_buffer_init_nolock(ma_resource_manager
...
@@ -2315,7 +2298,6 @@ static ma_result ma_resource_manager_data_buffer_init_nolock(ma_resource_manager
ma__free_from_callbacks
(
pDataBuffer
->
pNode
,
&
pResourceManager
->
config
.
allocationCallbacks
/*, MA_ALLOCATION_TYPE_RESOURCE_MANAGER_DATA_BUFFER*/
);
ma__free_from_callbacks
(
pDataBuffer
->
pNode
,
&
pResourceManager
->
config
.
allocationCallbacks
/*, MA_ALLOCATION_TYPE_RESOURCE_MANAGER_DATA_BUFFER*/
);
return
result
;
return
result
;
}
}
}
/* It's not really necessary, but for completeness we'll want to fire the event if we have one in synchronous mode. */
/* It's not really necessary, but for completeness we'll want to fire the event if we have one in synchronous mode. */
if
(
async
==
MA_FALSE
)
{
if
(
async
==
MA_FALSE
)
{
...
@@ -2347,7 +2329,7 @@ MA_API ma_result ma_resource_manager_data_buffer_init(ma_resource_manager* pReso
...
@@ -2347,7 +2329,7 @@ MA_API ma_result ma_resource_manager_data_buffer_init(ma_resource_manager* pReso
/* At this point we can now enter the critical section. */
/* At this point we can now enter the critical section. */
ma_mutex_lock
(
&
pResourceManager
->
dataBufferLock
);
ma_mutex_lock
(
&
pResourceManager
->
dataBufferLock
);
{
{
result
=
ma_resource_manager_data_buffer_init_nolock
(
pResourceManager
,
pFilePath
,
hashedName32
,
flags
,
NULL
,
pNotification
,
pDataBuffer
);
result
=
ma_resource_manager_data_buffer_init_nolock
(
pResourceManager
,
pFilePath
,
hashedName32
,
flags
,
pNotification
,
pDataBuffer
);
}
}
ma_mutex_unlock
(
&
pResourceManager
->
dataBufferLock
);
ma_mutex_unlock
(
&
pResourceManager
->
dataBufferLock
);
...
...
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