Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pistache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
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
Libraries
pistache
Commits
6c82bcdd
Commit
6c82bcdd
authored
Apr 06, 2016
by
Mathieu Stefani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Making it compile under gcc 4.7
parent
47158feb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
16 deletions
+53
-16
CMakeLists.txt
CMakeLists.txt
+8
-2
include/async.h
include/async.h
+13
-5
include/description.h
include/description.h
+5
-7
include/mailbox.h
include/mailbox.h
+26
-2
include/tcp.h
include/tcp.h
+1
-0
No files found.
CMakeLists.txt
View file @
6c82bcdd
...
...
@@ -24,7 +24,13 @@ include_directories (src)
add_subdirectory
(
examples
)
ADD_SUBDIRECTORY
(
googletest-release-1.7.0
)
find_package
(
GTest
)
if
(
GTEST_FOUND
)
include_directories
(
${
GTEST_INCLUDE_DIRS
}
)
else
()
ADD_SUBDIRECTORY
(
googletest-release-1.7.0
)
include_directories
(
${
gtest_SOURCE_DIR
}
/include
${
gtest_SOURCE_DIR
}
)
endif
()
enable_testing
()
include_directories
(
${
gtest_SOURCE_DIR
}
/include
${
gtest_SOURCE_DIR
}
)
add_subdirectory
(
tests
)
include/async.h
View file @
6c82bcdd
...
...
@@ -729,15 +729,24 @@ namespace Async {
static
constexpr
Private
::
Throw
Throw
{};
namespace
details
{
/*
* Note that we could use std::result_of to SFINAE-out and dispatch to the right call
* However, gcc 4.7 does not correctly support std::result_of for SFINAE purposes, so we
* use a decltype SFINAE-expression instead.
*
* See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3462.html and
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56283 for reference
*/
template
<
typename
T
,
typename
Func
>
typename
std
::
result_of
<
Func
(
Resolver
&
,
Rejection
&
)
>::
type
callAsync
(
Func
func
,
Resolver
&
resolver
,
Rejection
&
rejection
)
{
auto
callAsync
(
Func
func
,
Resolver
&
resolver
,
Rejection
&
rejection
)
->
decltype
(
std
::
declval
<
Func
>
()(
resolver
,
rejection
),
void
()
)
{
func
(
resolver
,
rejection
);
}
template
<
typename
T
,
typename
Func
>
typename
std
::
result_of
<
Func
(
Deferred
<
T
>
)
>::
type
callAsync
(
Func
func
,
Resolver
&
resolver
,
Rejection
&
rejection
)
{
auto
callAsync
(
Func
func
,
Resolver
&
resolver
,
Rejection
&
rejection
)
->
decltype
(
std
::
declval
<
Func
>
()(
Deferred
<
T
>
()),
void
()
)
{
func
(
Deferred
<
T
>
(
std
::
move
(
resolver
),
std
::
move
(
rejection
)));
}
};
...
...
@@ -756,7 +765,6 @@ namespace Async {
,
resolver_
(
core_
)
,
rejection_
(
core_
)
{
//func(resolver_, rejection_);
details
::
callAsync
<
T
>
(
func
,
resolver_
,
rejection_
);
}
...
...
include/description.h
View file @
6c82bcdd
...
...
@@ -57,7 +57,6 @@ namespace Type {
SCHEME(Wss , "wss") \
enum
class
Scheme
{
#define SCHEME(e, _) e,
SCHEMES
...
...
@@ -428,14 +427,14 @@ struct PathBuilder {
template
<
typename
...
Mimes
>
PathBuilder
&
produces
(
Mimes
...
mimes
)
{
const
Http
::
Mime
::
MediaType
m
[
]
=
{
mimes
...
};
Http
::
Mime
::
MediaType
m
[
sizeof
...(
Mimes
)
]
=
{
mimes
...
};
std
::
copy
(
std
::
begin
(
m
),
std
::
end
(
m
),
std
::
back_inserter
(
path_
->
pc
.
produce
));
return
*
this
;
}
template
<
typename
...
Mimes
>
PathBuilder
&
consumes
(
Mimes
...
mimes
)
{
const
Http
::
Mime
::
MediaType
m
[
]
=
{
mimes
...
};
Http
::
Mime
::
MediaType
m
[
sizeof
...(
Mimes
)
]
=
{
mimes
...
};
std
::
copy
(
std
::
begin
(
m
),
std
::
end
(
m
),
std
::
back_inserter
(
path_
->
pc
.
consume
));
return
*
this
;
}
...
...
@@ -525,22 +524,21 @@ public:
template
<
typename
...
Schemes
>
Description
&
schemes
(
Schemes
...
schemes
)
{
const
Scheme
s
[]
=
{
schemes
...
};
Scheme
s
[
sizeof
...(
Schemes
)]
=
{
schemes
...
};
std
::
copy
(
std
::
begin
(
s
),
std
::
end
(
s
),
std
::
back_inserter
(
schemes_
));
return
*
this
;
}
template
<
typename
...
Mimes
>
Description
&
produces
(
Mimes
...
mimes
)
{
const
Http
::
Mime
::
MediaType
m
[
]
=
{
mimes
...
};
Http
::
Mime
::
MediaType
m
[
sizeof
...(
Mimes
)
]
=
{
mimes
...
};
std
::
copy
(
std
::
begin
(
m
),
std
::
end
(
m
),
std
::
back_inserter
(
pc
.
produce
));
return
*
this
;
}
template
<
typename
...
Mimes
>
Description
&
consumes
(
Mimes
...
mimes
)
{
const
Http
::
Mime
::
MediaType
m
[
]
=
{
mimes
...
};
Http
::
Mime
::
MediaType
m
[
sizeof
...(
Mimes
)
]
=
{
mimes
...
};
std
::
copy
(
std
::
begin
(
m
),
std
::
end
(
m
),
std
::
back_inserter
(
pc
.
consume
));
return
*
this
;
}
...
...
include/mailbox.h
View file @
6c82bcdd
...
...
@@ -11,10 +11,12 @@
#include <atomic>
#include <stdexcept>
#include <array>
#include <sys/eventfd.h>
#include <unistd.h>
static
constexpr
size_t
CachelineSize
=
64
;
typedef
char
cacheline_pad_t
[
CachelineSize
];
template
<
typename
T
>
class
Mailbox
{
...
...
@@ -314,6 +316,25 @@ public:
MPMCQueue
(
const
MPMCQueue
&
other
)
=
delete
;
MPMCQueue
&
operator
=
(
const
MPMCQueue
&
other
)
=
delete
;
/*
* Note that you should not move a queue. This is somehow needed for gcc 4.7, otherwise
* the client won't compile
* @Investigate why
*/
MPMCQueue
(
MPMCQueue
&&
other
)
{
*
this
=
std
::
move
(
other
);
}
MPMCQueue
&
operator
=
(
MPMCQueue
&&
other
)
{
for
(
size_t
i
=
0
;
i
<
Size
;
++
i
)
{
cells_
[
i
].
sequence
.
store
(
other
.
cells_
[
i
].
sequence
.
load
(
std
::
memory_order_relaxed
),
std
::
memory_order_relaxed
);
cells_
[
i
].
data
=
std
::
move
(
other
.
cells_
[
i
].
data
);
}
enqueueIndex
.
store
(
other
.
enqueueIndex
.
load
(),
std
::
memory_order_relaxed
);
dequeueIndex
.
store
(
other
.
enqueueIndex
.
load
(),
std
::
memory_order_relaxed
);
}
MPMCQueue
()
{
for
(
size_t
i
=
0
;
i
<
Size
;
++
i
)
{
cells_
[
i
].
sequence
.
store
(
i
,
std
::
memory_order_relaxed
);
...
...
@@ -387,6 +408,9 @@ private:
std
::
array
<
Cell
,
Size
>
cells_
;
alignas
(
CachelineSize
)
std
::
atomic
<
size_t
>
enqueueIndex
;
alignas
(
CachelineSize
)
std
::
atomic
<
size_t
>
dequeueIndex
;
cacheline_pad_t
pad0
;
std
::
atomic
<
size_t
>
enqueueIndex
;
cacheline_pad_t
pad1
;
std
::
atomic
<
size_t
>
dequeueIndex
;
};
include/tcp.h
View file @
6c82bcdd
...
...
@@ -9,6 +9,7 @@
#include "flags.h"
#include "prototype.h"
#include <memory>
#include <stdexcept>
namespace
Net
{
...
...
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