Skip to content

Commit c21d267

Browse files
committed
Compile demo.
1 parent 88aaf18 commit c21d267

File tree

1 file changed

+12
-14
lines changed
  • lib_fiber/samples-c++1x/fiber_tbox4

1 file changed

+12
-14
lines changed

lib_fiber/samples-c++1x/fiber_tbox4/main.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ static void consuming1(acl::fiber_tbox<int>& box, int max) {
2323
}
2424

2525
static void test1(int max, bool read_in_fiber, bool send_in_fiber,
26-
bool blocking, bool notify_first) {
26+
bool notify_first) {
2727
std::shared_ptr<acl::fiber_tbox<int>> box(new
28-
acl::fiber_tbox<int>(true, !blocking));
28+
acl::fiber_tbox<int>(true));
2929

3030
std::shared_ptr<acl::wait_group> wg(new acl::wait_group());
3131

@@ -87,8 +87,8 @@ static void consuming2(acl::fiber_tbox2<int>& box, int max) {
8787
}
8888

8989
static void test2(int max, bool read_in_fiber, bool send_in_fiber,
90-
bool blocking, bool notify_first) {
91-
std::shared_ptr<acl::fiber_tbox2<int>> box(new acl::fiber_tbox2<int>(!blocking));
90+
bool notify_first) {
91+
std::shared_ptr<acl::fiber_tbox2<int>> box(new acl::fiber_tbox2<int>());
9292

9393
std::shared_ptr<acl::wait_group> wg(new acl::wait_group());
9494

@@ -135,7 +135,6 @@ static void test2(int max, bool read_in_fiber, bool send_in_fiber,
135135
static void usage(const char *procname) {
136136
printf("usage: %s -h[help]\r\n"
137137
" -n max\r\n"
138-
" -B [if use locker in blocking mode]\r\n"
139138
" -C [if consumer in fiber]\r\n"
140139
" -P [if producer in fiber]\r\n"
141140
" -S [if notify first]\r\n",
@@ -145,9 +144,9 @@ static void usage(const char *procname) {
145144
int main(int argc, char *argv[]) {
146145
int ch, max = 1000;
147146
bool read_in_fiber = false, send_in_fiber = false;
148-
bool blocking = false, notify_first = false;
147+
bool notify_first = false;
149148

150-
while ((ch = getopt(argc, argv, "hn:CPBS")) > 0) {
149+
while ((ch = getopt(argc, argv, "hn:CPS")) > 0) {
151150
switch (ch) {
152151
case 'h':
153152
usage(argv[0]);
@@ -161,9 +160,6 @@ int main(int argc, char *argv[]) {
161160
case 'P':
162161
send_in_fiber = true;
163162
break;
164-
case 'B':
165-
blocking = true;
166-
break;
167163
case 'S':
168164
notify_first = true;
169165
break;
@@ -175,14 +171,16 @@ int main(int argc, char *argv[]) {
175171

176172
struct timeval begin, end;
177173
gettimeofday(&begin, nullptr);
178-
test1(max, read_in_fiber, send_in_fiber, blocking, notify_first);
174+
test1(max, read_in_fiber, send_in_fiber, notify_first);
179175
gettimeofday(&end, nullptr);
180-
printf("fiber_tbox over now, max=%d, cost=%.2f\r\n", max, acl::stamp_sub(end, begin));
176+
printf("fiber_tbox over now, max=%d, cost=%.2f\r\n",
177+
max, acl::stamp_sub(end, begin));
181178

182179
gettimeofday(&begin, nullptr);
183-
test2(max, read_in_fiber, send_in_fiber, blocking, notify_first);
180+
test2(max, read_in_fiber, send_in_fiber, notify_first);
184181
gettimeofday(&end, nullptr);
185-
printf("fiber_tbox2 over now, max=%d, cost=%.2f\r\n", max, acl::stamp_sub(end, begin));
182+
printf("fiber_tbox2 over now, max=%d, cost=%.2f\r\n",
183+
max, acl::stamp_sub(end, begin));
186184

187185
return 0;
188186
}

0 commit comments

Comments
 (0)