Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
PRRT
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
37
Issues
37
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LARN
PRRT
Commits
17917a5f
Commit
17917a5f
authored
Mar 26, 2018
by
Andreas Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix C++ atomic.
parent
07bc5741
Pipeline
#2149
passed with stages
in 1 minute and 8 seconds
Changes
13
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
37 additions
and
15 deletions
+37
-15
prrt/CMakeLists.txt
prrt/CMakeLists.txt
+1
-1
prrt/defines.h
prrt/defines.h
+7
-0
prrt/proto/socket.h
prrt/proto/socket.h
+0
-1
prrt/proto/stores/packetDeliveryStore.c
prrt/proto/stores/packetDeliveryStore.c
+1
-1
prrt/util/mpsc_queue.h
prrt/util/mpsc_queue.h
+1
-1
prrt/util/pipe.h
prrt/util/pipe.h
+3
-3
tests/CMakeLists.txt
tests/CMakeLists.txt
+1
-1
tests/PrrtBlock_tests.cpp
tests/PrrtBlock_tests.cpp
+4
-3
tests/bitmap_tests.cpp
tests/bitmap_tests.cpp
+1
-1
tests/bptree_tests.cpp
tests/bptree_tests.cpp
+1
-1
tests/common.h
tests/common.h
+14
-0
tests/delivered_packet_table_tests.cpp
tests/delivered_packet_table_tests.cpp
+2
-1
tests/receptionTable_tests.cpp
tests/receptionTable_tests.cpp
+1
-1
No files found.
prrt/CMakeLists.txt
View file @
17917a5f
...
...
@@ -15,7 +15,7 @@ add_subdirectory(proto)
add_subdirectory
(
util
)
add_executable
(
sender sender.c
)
add_executable
(
receiver receiver.c
)
add_executable
(
receiver receiver.c
../tests/common.h
)
target_link_libraries
(
sender LINK_PUBLIC PRRT UTIL
${
CMAKE_THREAD_LIBS_INIT
}
)
target_link_libraries
(
receiver LINK_PUBLIC PRRT UTIL
${
CMAKE_THREAD_LIBS_INIT
}
)
prrt/defines.h
View file @
17917a5f
...
...
@@ -5,6 +5,13 @@
# define __builtin_ia32_rdtsc() (0)
#endif
#ifndef __cplusplus
# include <stdatomic.h>
#else
# include <atomic>
# define _Atomic(X) std::atomic< X >
#endif
#ifndef MAX
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#endif
...
...
prrt/proto/socket.h
View file @
17917a5f
#ifndef PRRT_SOCKET_H
#define PRRT_SOCKET_H
#include <stdatomic.h>
#include "../defines.h"
#include "../util/list.h"
#include "../util/pipe.h"
...
...
prrt/proto/stores/packetDeliveryStore.c
View file @
17917a5f
#include <pthread.h>
#include
<stdatomic.h>
#include
"../../defines.h"
#include "../types/packet.h"
#include "../../util/common.h"
#include "../../util/dbg.h"
...
...
prrt/util/mpsc_queue.h
View file @
17917a5f
...
...
@@ -5,7 +5,7 @@
#define PRRT_MPSC_QUEUE_H
#include <stdint.h>
#include
<stdatomic.h>
#include
"../defines.h"
typedef
struct
mpscq_node_t
mpscq_node_t
;
...
...
prrt/util/pipe.h
View file @
17917a5f
#ifndef PRRT_PIPE_H
#define PRRT_PIPE_H
#include "../defines.h"
#include "list.h"
#include "mpsc_queue.h"
#include <pthread.h>
#include <stdatomic.h>
typedef
struct
pipe
{
_Atomic
(
mpscq_node_t
*
)
head
;
mpscq_node_t
*
tail
;
atomic_int
space
;
atomic_int
items
;
_Atomic
(
int
)
space
;
_Atomic
(
int
)
items
;
}
Pipe
;
...
...
tests/CMakeLists.txt
View file @
17917a5f
add_subdirectory
(
lib/gtest-1.8.0
)
include_directories
(
SYSTEM
${
gtest_SOURCE_DIR
}
/include
${
gtest_SOURCE_DIR
}
)
add_executable
(
prrtTests bitmap_tests.cpp receptionTable_tests.cpp delivered_packet_table_tests.cpp bptree_tests.cpp PrrtBlock_tests.cpp
)
add_executable
(
prrtTests
common.h
bitmap_tests.cpp receptionTable_tests.cpp delivered_packet_table_tests.cpp bptree_tests.cpp PrrtBlock_tests.cpp
)
target_link_libraries
(
prrtTests LINK_PUBLIC gtest PRRT UTIL gtest_main
)
\ No newline at end of file
tests/PrrtBlock_tests.cpp
View file @
17917a5f
#include
<gtest/gtest.h>
#include
"common.h"
extern
"C"
{
...
...
@@ -15,7 +15,8 @@ protected:
virtual
void
SetUp
()
{
cpar
=
PrrtCodingParams_create
();
PrrtCodingParams_update
(
cpar
,
4
,
7
);
// TODO: Should be [3] instead of of NULL
PrrtCodingParams_update
(
cpar
,
4
,
7
,
1
,
NULL
);
encBlock
=
PrrtBlock_create
(
cpar
,
1
);
decBlock
=
PrrtBlock_create
(
cpar
,
1
);
}
...
...
@@ -169,7 +170,7 @@ TEST_F(PrrtBlockTest, EncodeDecode)
TEST_F
(
PrrtBlockTest
,
NoCodingConfigured
)
{
PrrtCodingParams
*
cpar
=
PrrtCodingParams_create
();
PrrtCodingParams_update
(
cpar
,
1
,
1
);
PrrtCodingParams_update
(
cpar
,
1
,
1
,
1
,
NULL
);
PrrtBlock
*
encBlock
=
PrrtBlock_create
(
cpar
,
1
);
PrrtBlock
*
decBlock
=
PrrtBlock_create
(
cpar
,
1
);
...
...
tests/bitmap_tests.cpp
View file @
17917a5f
#include
<gtest/gtest.h>
#include
"common.h"
extern
"C"
{
#include "prrt/util/bitmap.h"
...
...
tests/bptree_tests.cpp
View file @
17917a5f
#include
<gtest/gtest.h>
#include
"common.h"
extern
"C"
{
#include "prrt/util/bptree.h"
...
...
tests/common.h
0 → 100644
View file @
17917a5f
#ifndef PRRT_COMMON_H
#define PRRT_COMMON_H
#include <gtest/gtest.h>
#ifndef __cplusplus
# include <stdatomic.h>
#else
# include <atomic>
# define _Atomic(X) std::atomic< X >
#endif
#endif //PRRT_COMMON_H
tests/delivered_packet_table_tests.cpp
View file @
17917a5f
#include <gtest/gtest.h>
#include "common.h"
#include <cmath>
#include <prrt/proto/types/packet.h>
...
...
tests/receptionTable_tests.cpp
View file @
17917a5f
#include
<gtest/gtest.h>
#include
"common.h"
extern
"C"
{
#include "prrt/proto/stores/receptionTable.h"
...
...
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