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
96676f8f
Commit
96676f8f
authored
Jan 15, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v0.20.x'
parents
93b51d56
1f50bdb2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
2 deletions
+19
-2
NEWS
NEWS
+1
-0
Thread.cxx
src/thread/Thread.cxx
+4
-0
Thread.hxx
src/thread/Thread.hxx
+14
-2
No files found.
NEWS
View file @
96676f8f
...
...
@@ -25,6 +25,7 @@ ver 0.21 (not yet released)
* require GCC 5.0
ver 0.20.16 (not yet released)
* fix crash in debug build on Haiku and other operating systems
ver 0.20.15 (2018/01/05)
* queue: fix crash after seek failure
...
...
src/thread/Thread.cxx
View file @
96676f8f
...
...
@@ -86,6 +86,10 @@ Thread::ThreadProc(void *ctx) noexcept
{
Thread
&
thread
=
*
(
Thread
*
)
ctx
;
#ifndef NDEBUG
thread
.
inside_handle
=
pthread_self
();
#endif
thread
.
Run
();
return
nullptr
;
...
...
src/thread/Thread.hxx
View file @
96676f8f
...
...
@@ -41,6 +41,16 @@ class Thread {
DWORD
id
;
#else
pthread_t
handle
=
pthread_t
();
#ifndef NDEBUG
/**
* This handle is only used by IsInside(), and is set by the
* thread function. Since #handle is set by pthread_create()
* which is racy, we need this attribute for early checks
* inside the thread function.
*/
pthread_t
inside_handle
=
pthread_t
();
#endif
#endif
public
:
...
...
@@ -62,8 +72,9 @@ public:
#else
return
handle
!=
pthread_t
();
#endif
}
}
#ifndef NDEBUG
/**
* Check if this thread is the current thread.
*/
...
...
@@ -78,9 +89,10 @@ public:
default-constructed values" (comment from
libstdc++) - and if both libstdc++ and libc++ get
away with this, we can do it as well */
return
pthread_self
()
==
handle
;
return
pthread_self
()
==
inside_
handle
;
#endif
}
#endif
void
Start
();
void
Join
()
noexcept
;
...
...
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