Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
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
brpc
Commits
5654319b
Commit
5654319b
authored
Apr 13, 2018
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix explicit type conversion from bthread_t to pthread_t in mac
parent
57c13239
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
118 additions
and
102 deletions
+118
-102
CMakeLists.txt
example/asynchronous_echo_c++/CMakeLists.txt
+1
-1
CMakeLists.txt
example/backup_request_c++/CMakeLists.txt
+1
-1
CMakeLists.txt
example/cancel_c++/CMakeLists.txt
+1
-1
CMakeLists.txt
example/cascade_echo_c++/CMakeLists.txt
+1
-2
client.cpp
example/cascade_echo_c++/client.cpp
+8
-6
CMakeLists.txt
example/dynamic_partition_echo_c++/CMakeLists.txt
+1
-1
client.cpp
example/dynamic_partition_echo_c++/client.cpp
+8
-6
CMakeLists.txt
example/echo_c++/CMakeLists.txt
+1
-1
CMakeLists.txt
example/echo_c++_hulu_pbrpc/CMakeLists.txt
+1
-1
CMakeLists.txt
example/echo_c++_sofa_pbrpc/CMakeLists.txt
+1
-1
CMakeLists.txt
example/echo_c++_ubrpc_compack/CMakeLists.txt
+1
-1
CMakeLists.txt
example/http_c++/CMakeLists.txt
+1
-8
benchmark_http.cpp
example/http_c++/benchmark_http.cpp
+8
-6
CMakeLists.txt
example/memcache_c++/CMakeLists.txt
+1
-1
client.cpp
example/memcache_c++/client.cpp
+8
-6
CMakeLists.txt
example/multi_threaded_echo_c++/CMakeLists.txt
+1
-1
client.cpp
example/multi_threaded_echo_c++/client.cpp
+8
-6
CMakeLists.txt
example/multi_threaded_echo_fns_c++/CMakeLists.txt
+1
-1
client.cpp
example/multi_threaded_echo_fns_c++/client.cpp
+8
-6
CMakeLists.txt
example/multi_threaded_mcpack_c++/CMakeLists.txt
+1
-1
client.cpp
example/multi_threaded_mcpack_c++/client.cpp
+8
-6
CMakeLists.txt
example/nshead_extension_c++/CMakeLists.txt
+1
-1
CMakeLists.txt
example/nshead_pb_extension_c++/CMakeLists.txt
+1
-1
CMakeLists.txt
example/parallel_echo_c++/CMakeLists.txt
+1
-1
client.cpp
example/parallel_echo_c++/client.cpp
+8
-6
CMakeLists.txt
example/partition_echo_c++/CMakeLists.txt
+1
-1
client.cpp
example/partition_echo_c++/client.cpp
+8
-6
CMakeLists.txt
example/redis_c++/CMakeLists.txt
+1
-1
redis_press.cpp
example/redis_c++/redis_press.cpp
+8
-6
CMakeLists.txt
example/selective_echo_c++/CMakeLists.txt
+1
-1
client.cpp
example/selective_echo_c++/client.cpp
+8
-6
CMakeLists.txt
example/session_data_and_thread_local/CMakeLists.txt
+1
-1
client.cpp
example/session_data_and_thread_local/client.cpp
+8
-6
CMakeLists.txt
example/streaming_echo_c++/CMakeLists.txt
+1
-1
No files found.
example/asynchronous_echo_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(asynchronous_echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/backup_request_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(backup_request_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/cancel_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(cancel_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/cascade_echo_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,12 +4,11 @@ project(cascade_echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set
(
CMAKE_PREFIX_PATH
${
OUTPUT_PATH
}
)
include
(
FindThreads
)
include
(
FindProtobuf
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
...
...
example/cascade_echo_c++/client.cpp
View file @
5654319b
...
...
@@ -103,19 +103,21 @@ int main(int argc, char* argv[]) {
return
-
1
;
}
std
::
vector
<
bthread_t
>
t
ids
;
tids
.
resize
(
FLAGS_thread_num
)
;
std
::
vector
<
bthread_t
>
b
ids
;
std
::
vector
<
pthread_t
>
pids
;
if
(
!
FLAGS_use_bthread
)
{
pids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
pthread_create
(
(
pthread_t
*
)
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
if
(
pthread_create
(
&
p
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create pthread"
;
return
-
1
;
}
}
}
else
{
bids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
bthread_start_background
(
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
&
b
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create bthread"
;
return
-
1
;
}
...
...
@@ -135,9 +137,9 @@ int main(int argc, char* argv[]) {
LOG
(
INFO
)
<<
"EchoClient is going to quit"
;
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
!
FLAGS_use_bthread
)
{
pthread_join
(
(
pthread_t
)
t
ids
[
i
],
NULL
);
pthread_join
(
p
ids
[
i
],
NULL
);
}
else
{
bthread_join
(
t
ids
[
i
],
NULL
);
bthread_join
(
b
ids
[
i
],
NULL
);
}
}
return
0
;
...
...
example/dynamic_partition_echo_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(dynamic_partition_echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/dynamic_partition_echo_c++/client.cpp
View file @
5654319b
...
...
@@ -148,19 +148,21 @@ int main(int argc, char* argv[]) {
}
g_request
.
resize
(
FLAGS_request_size
,
'r'
);
std
::
vector
<
bthread_t
>
t
ids
;
tids
.
resize
(
FLAGS_thread_num
)
;
std
::
vector
<
bthread_t
>
b
ids
;
std
::
vector
<
pthread_t
>
pids
;
if
(
!
FLAGS_use_bthread
)
{
pids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
pthread_create
(
(
pthread_t
*
)
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
if
(
pthread_create
(
&
p
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create pthread"
;
return
-
1
;
}
}
}
else
{
bids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
bthread_start_background
(
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
&
b
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create bthread"
;
return
-
1
;
}
...
...
@@ -198,9 +200,9 @@ int main(int argc, char* argv[]) {
LOG
(
INFO
)
<<
"EchoClient is going to quit"
;
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
!
FLAGS_use_bthread
)
{
pthread_join
(
(
pthread_t
)
t
ids
[
i
],
NULL
);
pthread_join
(
p
ids
[
i
],
NULL
);
}
else
{
bthread_join
(
t
ids
[
i
],
NULL
);
bthread_join
(
b
ids
[
i
],
NULL
);
}
}
...
...
example/echo_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/echo_c++_hulu_pbrpc/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(echo_c++_hulu_pbrpc C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/echo_c++_sofa_pbrpc/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(echo_c++_sofa_pbrpc C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/echo_c++_ubrpc_compack/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(echo_c++_ubrpc_compack C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/http_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,14 +4,7 @@ project(http_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
set
(
CMAKE_PREFIX_PATH
${
OUTPUT_PATH
}
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/http_c++/benchmark_http.cpp
View file @
5654319b
...
...
@@ -87,19 +87,21 @@ int main(int argc, char* argv[]) {
return
-
1
;
}
std
::
vector
<
bthread_t
>
t
ids
;
tids
.
resize
(
FLAGS_thread_num
)
;
std
::
vector
<
bthread_t
>
b
ids
;
std
::
vector
<
pthread_t
>
pids
;
if
(
!
FLAGS_use_bthread
)
{
pids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
pthread_create
(
(
pthread_t
*
)
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
if
(
pthread_create
(
&
p
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create pthread"
;
return
-
1
;
}
}
}
else
{
bids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
bthread_start_background
(
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
&
b
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create bthread"
;
return
-
1
;
}
...
...
@@ -120,9 +122,9 @@ int main(int argc, char* argv[]) {
LOG
(
INFO
)
<<
"benchmark_http is going to quit"
;
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
!
FLAGS_use_bthread
)
{
pthread_join
(
(
pthread_t
)
t
ids
[
i
],
NULL
);
pthread_join
(
p
ids
[
i
],
NULL
);
}
else
{
bthread_join
(
t
ids
[
i
],
NULL
);
bthread_join
(
b
ids
[
i
],
NULL
);
}
}
...
...
example/memcache_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(memcache_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/memcache_c++/client.cpp
View file @
5654319b
...
...
@@ -158,19 +158,21 @@ int main(int argc, char* argv[]) {
<<
" values, never expired"
;
}
std
::
vector
<
bthread_t
>
t
ids
;
tids
.
resize
(
FLAGS_thread_num
)
;
std
::
vector
<
bthread_t
>
b
ids
;
std
::
vector
<
pthread_t
>
pids
;
if
(
!
FLAGS_use_bthread
)
{
pids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
pthread_create
(
(
pthread_t
*
)
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
if
(
pthread_create
(
&
p
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create pthread"
;
return
-
1
;
}
}
}
else
{
bids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
bthread_start_background
(
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
&
b
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create bthread"
;
return
-
1
;
}
...
...
@@ -186,9 +188,9 @@ int main(int argc, char* argv[]) {
LOG
(
INFO
)
<<
"memcache_client is going to quit"
;
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
!
FLAGS_use_bthread
)
{
pthread_join
(
(
pthread_t
)
t
ids
[
i
],
NULL
);
pthread_join
(
p
ids
[
i
],
NULL
);
}
else
{
bthread_join
(
t
ids
[
i
],
NULL
);
bthread_join
(
b
ids
[
i
],
NULL
);
}
}
if
(
options
.
auth
)
{
...
...
example/multi_threaded_echo_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(multi_threaded_echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/multi_threaded_echo_c++/client.cpp
View file @
5654319b
...
...
@@ -117,19 +117,21 @@ int main(int argc, char* argv[]) {
brpc
::
StartDummyServerAt
(
FLAGS_dummy_port
);
}
std
::
vector
<
bthread_t
>
t
ids
;
tids
.
resize
(
FLAGS_thread_num
)
;
std
::
vector
<
bthread_t
>
b
ids
;
std
::
vector
<
pthread_t
>
pids
;
if
(
!
FLAGS_use_bthread
)
{
pids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
pthread_create
(
(
pthread_t
*
)
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
if
(
pthread_create
(
&
p
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create pthread"
;
return
-
1
;
}
}
}
else
{
bids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
bthread_start_background
(
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
&
b
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create bthread"
;
return
-
1
;
}
...
...
@@ -145,9 +147,9 @@ int main(int argc, char* argv[]) {
LOG
(
INFO
)
<<
"EchoClient is going to quit"
;
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
!
FLAGS_use_bthread
)
{
pthread_join
(
(
pthread_t
)
t
ids
[
i
],
NULL
);
pthread_join
(
p
ids
[
i
],
NULL
);
}
else
{
bthread_join
(
t
ids
[
i
],
NULL
);
bthread_join
(
b
ids
[
i
],
NULL
);
}
}
...
...
example/multi_threaded_echo_fns_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(multi_threaded_echo_fns_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/multi_threaded_echo_fns_c++/client.cpp
View file @
5654319b
...
...
@@ -119,19 +119,21 @@ int main(int argc, char* argv[]) {
brpc
::
StartDummyServerAt
(
FLAGS_dummy_port
);
}
std
::
vector
<
bthread_t
>
t
ids
;
tids
.
resize
(
FLAGS_thread_num
)
;
std
::
vector
<
bthread_t
>
b
ids
;
std
::
vector
<
pthread_t
>
pids
;
if
(
!
FLAGS_use_bthread
)
{
pids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
pthread_create
(
(
pthread_t
*
)
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
if
(
pthread_create
(
&
p
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create pthread"
;
return
-
1
;
}
}
}
else
{
bids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
bthread_start_background
(
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
&
b
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create bthread"
;
return
-
1
;
}
...
...
@@ -147,9 +149,9 @@ int main(int argc, char* argv[]) {
LOG
(
INFO
)
<<
"EchoClient is going to quit"
;
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
!
FLAGS_use_bthread
)
{
pthread_join
(
(
pthread_t
)
t
ids
[
i
],
NULL
);
pthread_join
(
p
ids
[
i
],
NULL
);
}
else
{
bthread_join
(
t
ids
[
i
],
NULL
);
bthread_join
(
b
ids
[
i
],
NULL
);
}
}
...
...
example/multi_threaded_mcpack_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(multi_threaded_mcpack_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/multi_threaded_mcpack_c++/client.cpp
View file @
5654319b
...
...
@@ -113,19 +113,21 @@ int main(int argc, char* argv[]) {
brpc
::
StartDummyServerAt
(
FLAGS_dummy_port
);
}
std
::
vector
<
bthread_t
>
t
ids
;
tids
.
resize
(
FLAGS_thread_num
)
;
std
::
vector
<
bthread_t
>
b
ids
;
std
::
vector
<
pthread_t
>
pids
;
if
(
!
FLAGS_use_bthread
)
{
pids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
pthread_create
(
(
pthread_t
*
)
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
if
(
pthread_create
(
&
p
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create pthread"
;
return
-
1
;
}
}
}
else
{
bids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
bthread_start_background
(
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
&
b
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create bthread"
;
return
-
1
;
}
...
...
@@ -141,9 +143,9 @@ int main(int argc, char* argv[]) {
LOG
(
INFO
)
<<
"EchoClient is going to quit"
;
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
!
FLAGS_use_bthread
)
{
pthread_join
(
(
pthread_t
)
t
ids
[
i
],
NULL
);
pthread_join
(
p
ids
[
i
],
NULL
);
}
else
{
bthread_join
(
t
ids
[
i
],
NULL
);
bthread_join
(
b
ids
[
i
],
NULL
);
}
}
...
...
example/nshead_extension_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(nshead_extension_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/nshead_pb_extension_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(nshead_pb_extension_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/parallel_echo_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(parallel_echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/parallel_echo_c++/client.cpp
View file @
5654319b
...
...
@@ -165,19 +165,21 @@ int main(int argc, char* argv[]) {
brpc
::
StartDummyServerAt
(
FLAGS_dummy_port
);
}
std
::
vector
<
bthread_t
>
t
ids
;
tids
.
resize
(
FLAGS_thread_num
)
;
std
::
vector
<
bthread_t
>
b
ids
;
std
::
vector
<
pthread_t
>
pids
;
if
(
!
FLAGS_use_bthread
)
{
pids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
pthread_create
(
(
pthread_t
*
)
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
if
(
pthread_create
(
&
p
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create pthread"
;
return
-
1
;
}
}
}
else
{
bids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
bthread_start_background
(
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
&
b
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create bthread"
;
return
-
1
;
}
...
...
@@ -199,9 +201,9 @@ int main(int argc, char* argv[]) {
LOG
(
INFO
)
<<
"EchoClient is going to quit"
;
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
!
FLAGS_use_bthread
)
{
pthread_join
(
(
pthread_t
)
t
ids
[
i
],
NULL
);
pthread_join
(
p
ids
[
i
],
NULL
);
}
else
{
bthread_join
(
t
ids
[
i
],
NULL
);
bthread_join
(
b
ids
[
i
],
NULL
);
}
}
...
...
example/partition_echo_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(partition_echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/partition_echo_c++/client.cpp
View file @
5654319b
...
...
@@ -150,19 +150,21 @@ int main(int argc, char* argv[]) {
}
g_request
.
resize
(
FLAGS_request_size
,
'r'
);
std
::
vector
<
bthread_t
>
t
ids
;
tids
.
resize
(
FLAGS_thread_num
)
;
std
::
vector
<
bthread_t
>
b
ids
;
std
::
vector
<
pthread_t
>
pids
;
if
(
!
FLAGS_use_bthread
)
{
pids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
pthread_create
(
(
pthread_t
*
)
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
if
(
pthread_create
(
&
p
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create pthread"
;
return
-
1
;
}
}
}
else
{
bids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
bthread_start_background
(
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
&
b
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create bthread"
;
return
-
1
;
}
...
...
@@ -200,9 +202,9 @@ int main(int argc, char* argv[]) {
LOG
(
INFO
)
<<
"EchoClient is going to quit"
;
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
!
FLAGS_use_bthread
)
{
pthread_join
(
(
pthread_t
)
t
ids
[
i
],
NULL
);
pthread_join
(
p
ids
[
i
],
NULL
);
}
else
{
bthread_join
(
t
ids
[
i
],
NULL
);
bthread_join
(
b
ids
[
i
],
NULL
);
}
}
...
...
example/redis_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -12,7 +12,7 @@ project(redis_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/redis_c++/redis_press.cpp
View file @
5654319b
...
...
@@ -143,21 +143,23 @@ int main(int argc, char* argv[]) {
brpc
::
StartDummyServerAt
(
FLAGS_dummy_port
);
}
std
::
vector
<
bthread_t
>
tids
;
std
::
vector
<
bthread_t
>
bids
;
std
::
vector
<
pthread_t
>
pids
;
bids
.
resize
(
FLAGS_thread_num
);
pids
.
resize
(
FLAGS_thread_num
);
std
::
vector
<
SenderArgs
>
args
;
tids
.
resize
(
FLAGS_thread_num
);
args
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
args
[
i
].
base_index
=
i
*
FLAGS_batch
;
args
[
i
].
redis_channel
=
&
channel
;
if
(
!
FLAGS_use_bthread
)
{
if
(
pthread_create
(
(
pthread_t
*
)
&
t
ids
[
i
],
NULL
,
sender
,
&
args
[
i
])
!=
0
)
{
if
(
pthread_create
(
&
p
ids
[
i
],
NULL
,
sender
,
&
args
[
i
])
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create pthread"
;
return
-
1
;
}
}
else
{
if
(
bthread_start_background
(
&
t
ids
[
i
],
NULL
,
sender
,
&
args
[
i
])
!=
0
)
{
&
b
ids
[
i
],
NULL
,
sender
,
&
args
[
i
])
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create bthread"
;
return
-
1
;
}
...
...
@@ -174,9 +176,9 @@ int main(int argc, char* argv[]) {
LOG
(
INFO
)
<<
"redis_client is going to quit"
;
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
!
FLAGS_use_bthread
)
{
pthread_join
(
(
pthread_t
)
t
ids
[
i
],
NULL
);
pthread_join
(
p
ids
[
i
],
NULL
);
}
else
{
bthread_join
(
t
ids
[
i
],
NULL
);
bthread_join
(
b
ids
[
i
],
NULL
);
}
}
return
0
;
...
...
example/selective_echo_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(selective_echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/selective_echo_c++/client.cpp
View file @
5654319b
...
...
@@ -197,19 +197,21 @@ int main(int argc, char* argv[]) {
}
g_request
.
resize
(
FLAGS_request_size
,
'r'
);
std
::
vector
<
bthread_t
>
t
ids
;
tids
.
resize
(
FLAGS_thread_num
)
;
std
::
vector
<
bthread_t
>
b
ids
;
std
::
vector
<
pthread_t
>
pids
;
if
(
!
FLAGS_use_bthread
)
{
pids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
pthread_create
(
(
pthread_t
*
)
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
if
(
pthread_create
(
&
p
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create pthread"
;
return
-
1
;
}
}
}
else
{
bids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
bthread_start_background
(
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
&
b
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create bthread"
;
return
-
1
;
}
...
...
@@ -225,9 +227,9 @@ int main(int argc, char* argv[]) {
LOG
(
INFO
)
<<
"EchoClient is going to quit"
;
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
!
FLAGS_use_bthread
)
{
pthread_join
(
(
pthread_t
)
t
ids
[
i
],
NULL
);
pthread_join
(
p
ids
[
i
],
NULL
);
}
else
{
bthread_join
(
t
ids
[
i
],
NULL
);
bthread_join
(
b
ids
[
i
],
NULL
);
}
}
...
...
example/session_data_and_thread_local/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(session_data_and_thread_local C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
example/session_data_and_thread_local/client.cpp
View file @
5654319b
...
...
@@ -108,19 +108,21 @@ int main(int argc, char* argv[]) {
}
g_request
.
resize
(
FLAGS_request_size
,
'r'
);
std
::
vector
<
bthread_t
>
t
ids
;
tids
.
resize
(
FLAGS_thread_num
)
;
std
::
vector
<
bthread_t
>
b
ids
;
std
::
vector
<
pthread_t
>
pids
;
if
(
!
FLAGS_use_bthread
)
{
pids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
pthread_create
(
(
pthread_t
*
)
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
if
(
pthread_create
(
&
p
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create pthread"
;
return
-
1
;
}
}
}
else
{
bids
.
resize
(
FLAGS_thread_num
);
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
bthread_start_background
(
&
t
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
&
b
ids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create bthread"
;
return
-
1
;
}
...
...
@@ -136,9 +138,9 @@ int main(int argc, char* argv[]) {
LOG
(
INFO
)
<<
"EchoClient is going to quit"
;
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
!
FLAGS_use_bthread
)
{
pthread_join
(
(
pthread_t
)
t
ids
[
i
],
NULL
);
pthread_join
(
p
ids
[
i
],
NULL
);
}
else
{
bthread_join
(
t
ids
[
i
],
NULL
);
bthread_join
(
b
ids
[
i
],
NULL
);
}
}
...
...
example/streaming_echo_c++/CMakeLists.txt
View file @
5654319b
...
...
@@ -4,7 +4,7 @@ project(streaming_echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
name
\"
include
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -
regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
)
...
...
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