Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
5af76cac
Commit
5af76cac
authored
Sep 23, 2016
by
Kenton Varda
Committed by
GitHub
Sep 23, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #365 from mark-grimes/msvcThreadFix
Fixes for windows
parents
ce99c604
90c39c42
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
layout.c++
c++/src/capnp/layout.c++
+1
-1
thread.c++
c++/src/kj/thread.c++
+3
-3
thread.h
c++/src/kj/thread.h
+1
-1
No files found.
c++/src/capnp/layout.c++
View file @
5af76cac
...
...
@@ -1606,7 +1606,7 @@ struct WireHelpers {
if
(
dataSize
%
BYTES_PER_WORD
!=
0
*
BYTES
)
{
//Zero-pad the data if it didn't use the entire last word
byte
*
padStart
=
reinterpret_cast
<
byte
*>
(
ptr
)
+
(
dataSize
/
BYTES
);
bzero
(
padStart
,
(
BYTES_PER_WORD
*
WORDS
-
(
dataSize
%
BYTES_PER_WORD
))
/
BYTES
);
memset
(
padStart
,
0
,
(
BYTES_PER_WORD
*
WORDS
-
(
dataSize
%
BYTES_PER_WORD
))
/
BYTES
);
}
}
...
...
c++/src/kj/thread.c++
View file @
5af76cac
...
...
@@ -24,6 +24,7 @@
#if _WIN32
#include <windows.h>
#include "windows-sanity.h"
#else
#include <pthread.h>
#include <signal.h>
...
...
@@ -42,7 +43,7 @@ Thread::~Thread() noexcept(false) {
if
(
!
detached
)
{
KJ_ASSERT
(
WaitForSingleObject
(
threadHandle
,
INFINITE
)
!=
WAIT_FAILED
);
KJ_IF_MAYBE
(
e
,
exception
)
{
KJ_IF_MAYBE
(
e
,
state
->
exception
)
{
kj
::
throwRecoverableException
(
kj
::
mv
(
*
e
));
}
}
...
...
@@ -125,8 +126,7 @@ void* Thread::runThread(void* ptr) {
void
Thread
::
ThreadState
::
unref
()
{
#if _MSC_VER
if
(
_InterlockedDecrement_rel
(
&
refcount
))
{
_ReadBarrier
();
if
(
_InterlockedDecrement
(
&
refcount
))
{
#else
if
(
__atomic_sub_fetch
(
&
refcount
,
1
,
__ATOMIC_RELEASE
)
==
0
)
{
__atomic_thread_fence
(
__ATOMIC_ACQUIRE
);
...
...
c++/src/kj/thread.h
View file @
5af76cac
...
...
@@ -59,7 +59,7 @@ private:
Function
<
void
()
>
func
;
kj
::
Maybe
<
kj
::
Exception
>
exception
;
int
refcount
;
unsigned
int
refcount
;
// Owned by the parent thread and the child thread.
void
unref
();
...
...
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