Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
752ff12c
Commit
752ff12c
authored
Feb 10, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
thread/Thread: move code to Run()
parent
4bb89b17
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
14 deletions
+24
-14
Thread.cxx
src/thread/Thread.cxx
+22
-14
Thread.hxx
src/thread/Thread.hxx
+2
-0
No files found.
src/thread/Thread.cxx
View file @
752ff12c
...
@@ -76,6 +76,26 @@ Thread::Join()
...
@@ -76,6 +76,26 @@ Thread::Join()
#endif
#endif
}
}
inline
void
Thread
::
Run
()
{
#ifndef WIN32
#ifndef NDEBUG
/* this works around a race condition that causes an assertion
failure due to IsInside() spuriously returning false right
after the thread has been created, and the calling thread
hasn't initialised "defined" yet */
defined
=
true
;
#endif
#endif
f
(
ctx
);
#ifdef ANDROID
Java
::
DetachCurrentThread
();
#endif
}
#ifdef _WIN32
#ifdef _WIN32
DWORD
WINAPI
DWORD
WINAPI
...
@@ -83,7 +103,7 @@ Thread::ThreadProc(LPVOID ctx)
...
@@ -83,7 +103,7 @@ Thread::ThreadProc(LPVOID ctx)
{
{
Thread
&
thread
=
*
(
Thread
*
)
ctx
;
Thread
&
thread
=
*
(
Thread
*
)
ctx
;
thread
.
f
(
thread
.
ctx
);
thread
.
Run
(
);
return
0
;
return
0
;
}
}
...
@@ -94,19 +114,7 @@ Thread::ThreadProc(void *ctx)
...
@@ -94,19 +114,7 @@ Thread::ThreadProc(void *ctx)
{
{
Thread
&
thread
=
*
(
Thread
*
)
ctx
;
Thread
&
thread
=
*
(
Thread
*
)
ctx
;
#ifndef NDEBUG
thread
.
Run
();
/* this works around a race condition that causes an assertion
failure due to IsInside() spuriously returning false right
after the thread has been created, and the calling thread
hasn't initialised "defined" yet */
thread
.
defined
=
true
;
#endif
thread
.
f
(
thread
.
ctx
);
#ifdef ANDROID
Java
::
DetachCurrentThread
();
#endif
return
nullptr
;
return
nullptr
;
}
}
...
...
src/thread/Thread.hxx
View file @
752ff12c
...
@@ -93,6 +93,8 @@ public:
...
@@ -93,6 +93,8 @@ public:
void
Join
();
void
Join
();
private
:
private
:
void
Run
();
#ifdef _WIN32
#ifdef _WIN32
static
DWORD
WINAPI
ThreadProc
(
LPVOID
ctx
);
static
DWORD
WINAPI
ThreadProc
(
LPVOID
ctx
);
#else
#else
...
...
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