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
ebf0826b
Commit
ebf0826b
authored
Jun 08, 2020
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify the ma_thread structure.
parent
66e7518e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
26 deletions
+11
-26
miniaudio.h
miniaudio.h
+11
-26
No files found.
miniaudio.h
View file @
ebf0826b
...
...
@@ -3000,27 +3000,12 @@ typedef enum
ma_thread_priority_default = 0
} ma_thread_priority;
typedef struct
{
ma_context* pContext;
union
{
#ifdef MA_WIN32
struct
{
/*HANDLE*/ ma_handle hThread;
} win32;
#if defined(MA_WIN32)
typedef ma_handle ma_thread;
#endif
#ifdef MA_POSIX
struct
{
pthread_t thread;
} posix;
#if defined(MA_POSIX)
typedef pthread_t ma_thread;
#endif
int _unused;
};
} ma_thread;
#if defined(MA_WIN32)
typedef ma_handle ma_mutex;
...
...
@@ -3035,9 +3020,9 @@ typedef ma_handle ma_event;
#if defined(MA_POSIX)
typedef struct
{
ma_uint32 value;
pthread_mutex_t lock;
pthread_cond_t cond;
ma_uint32 value;
} ma_event;
#endif
...
...
@@ -7707,19 +7692,19 @@ static int ma_thread_priority_to_win32(ma_thread_priority priority)
static ma_result ma_thread_create__win32(ma_thread* pThread, ma_thread_priority priority, ma_thread_entry_proc entryProc, void* pData)
{
pThread->win32.h
Thread = CreateThread(NULL, 0, entryProc, pData, 0, NULL);
if (
pThread->win32.h
Thread == NULL) {
*p
Thread = CreateThread(NULL, 0, entryProc, pData, 0, NULL);
if (
*p
Thread == NULL) {
return ma_result_from_GetLastError(GetLastError());
}
SetThreadPriority((HANDLE)
pThread->win32.h
Thread, ma_thread_priority_to_win32(priority));
SetThreadPriority((HANDLE)
*p
Thread, ma_thread_priority_to_win32(priority));
return MA_SUCCESS;
}
static void ma_thread_wait__win32(ma_thread* pThread)
{
WaitForSingleObject(
pThread->win32.h
Thread, INFINITE);
WaitForSingleObject(
(HANDLE)*p
Thread, INFINITE);
}
static void ma_sleep__win32(ma_uint32 milliseconds)
...
...
@@ -7870,7 +7855,7 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority
}
#endif
result = pthread_create(
&pThread->posix.t
hread, pAttr, entryProc, pData);
result = pthread_create(
pT
hread, pAttr, entryProc, pData);
if (result != 0) {
return ma_result_from_errno(result);
}
...
...
@@ -7880,7 +7865,7 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority
static void ma_thread_wait__posix(ma_thread* pThread)
{
pthread_join(pThread
->posix.thread
, NULL);
pthread_join(pThread, NULL);
}
#if !defined(MA_EMSCRIPTEN)
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