28
28
#include < sys/eventfd.h>
29
29
#endif
30
30
31
- using std::atomic;
32
- using std::vector;
33
-
34
- using td::int32;
35
- using td::uint32;
36
-
37
31
#define MODE std::memory_order_relaxed
38
32
39
33
// void set_affinity(int mask) {
@@ -100,7 +94,7 @@ class Backoff {
100
94
};
101
95
102
96
class VarQueue {
103
- atomic<qvalue_t > data;
97
+ std:: atomic<qvalue_t > data{ 0 } ;
104
98
105
99
public:
106
100
void init () {
@@ -218,17 +212,17 @@ const int queue_buf_size = 1 << 10;
218
212
class BufferQueue {
219
213
struct node {
220
214
qvalue_t val;
221
- char pad[64 - sizeof (atomic<qvalue_t >)];
215
+ char pad[64 - sizeof (std:: atomic<qvalue_t >)];
222
216
};
223
217
node q[queue_buf_size];
224
218
225
219
struct Position {
226
- atomic<uint32> i;
227
- char pad[64 - sizeof (atomic<uint32>)];
220
+ std:: atomic<td:: uint32> i{ 0 } ;
221
+ char pad[64 - sizeof (std:: atomic<td:: uint32>)];
228
222
229
- uint32 local_read_i;
230
- uint32 local_write_i;
231
- char pad2[64 - sizeof (uint32) * 2 ];
223
+ td:: uint32 local_read_i;
224
+ td:: uint32 local_write_i;
225
+ char pad2[64 - sizeof (td:: uint32) * 2 ];
232
226
233
227
void init () {
234
228
i = 0 ;
@@ -342,7 +336,7 @@ class BufferQueue {
342
336
#if TD_LINUX
343
337
class BufferedFdQueue {
344
338
int fd;
345
- atomic<int > wait_flag;
339
+ std:: atomic<int > wait_flag{ 0 } ;
346
340
BufferQueue q;
347
341
char pad[64 ];
348
342
@@ -440,7 +434,7 @@ class BufferedFdQueue {
440
434
441
435
class FdQueue {
442
436
int fd;
443
- atomic<int > wait_flag;
437
+ std:: atomic<int > wait_flag{ 0 } ;
444
438
VarQueue q;
445
439
char pad[64 ];
446
440
@@ -572,8 +566,8 @@ class QueueBenchmark2 : public td::Benchmark {
572
566
573
567
int server_active_connections;
574
568
int client_active_connections;
575
- vector<td::int64> server_conn;
576
- vector<td::int64> client_conn;
569
+ std:: vector<td::int64> server_conn;
570
+ std:: vector<td::int64> client_conn;
577
571
578
572
public:
579
573
explicit QueueBenchmark2 (int connections_n = 1 ) : connections_n(connections_n) {
@@ -615,7 +609,7 @@ class QueueBenchmark2 : public td::Benchmark {
615
609
}
616
610
617
611
void *server_run (void *) {
618
- server_conn = vector<td::int64>(connections_n);
612
+ server_conn = std:: vector<td::int64>(connections_n);
619
613
server_active_connections = connections_n;
620
614
621
615
while (server_active_connections > 0 ) {
@@ -656,7 +650,7 @@ class QueueBenchmark2 : public td::Benchmark {
656
650
}
657
651
658
652
void *client_run (void *) {
659
- client_conn = vector<td::int64>(connections_n);
653
+ client_conn = std:: vector<td::int64>(connections_n);
660
654
client_active_connections = connections_n;
661
655
if (queries_n >= (1 << 24 )) {
662
656
std::fprintf (stderr, " Too big queries_n\n " );
@@ -732,7 +726,7 @@ class QueueBenchmark : public td::Benchmark {
732
726
}
733
727
734
728
void *server_run (void *) {
735
- vector<td::int64> conn (connections_n);
729
+ std:: vector<td::int64> conn (connections_n);
736
730
int active_connections = connections_n;
737
731
while (active_connections > 0 ) {
738
732
qvalue_t value = server.get ();
@@ -756,7 +750,7 @@ class QueueBenchmark : public td::Benchmark {
756
750
}
757
751
758
752
void *client_run (void *) {
759
- vector<td::int64> conn (connections_n);
753
+ std:: vector<td::int64> conn (connections_n);
760
754
if (queries_n >= (1 << 24 )) {
761
755
std::fprintf (stderr, " Too big queries_n\n " );
762
756
std::exit (0 );
@@ -789,7 +783,7 @@ class QueueBenchmark : public td::Benchmark {
789
783
}
790
784
791
785
void *client_run2 (void *) {
792
- vector<td::int64> conn (connections_n);
786
+ std:: vector<td::int64> conn (connections_n);
793
787
if (queries_n >= (1 << 24 )) {
794
788
std::fprintf (stderr, " Too big queries_n\n " );
795
789
std::exit (0 );
0 commit comments