File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
samples-c++1x/fiber_tbox3 Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,9 @@ static int __total_count = 2;
77static int __diff_delay = 10000 ;
88static int __delay = 10 ;
99static acl::fiber_event_t __event_type = acl::FIBER_EVENT_T_KERNEL;
10- static acl::atomic_long __producing = 0 ;
11- static acl::atomic_long __consuming = 0 ;
12- static acl::atomic_long __timedout = 0 ;
10+ static acl::atomic_long __producing;
11+ static acl::atomic_long __consuming;
12+ static acl::atomic_long __timedout;
1313
1414class myobj
1515{
Original file line number Diff line number Diff line change 11#include " stdafx.h"
2+ #include < thread>
23#include < stdio.h>
34#include < stdlib.h>
45
56int main ()
67{
78 acl::fiber_tbox<int > box;
89
9- go[&box] {
10+ #define THREAD_PRODUCER
11+ #ifdef THREAD_PRODUCER
12+ std::thread thr ([&box] {
13+ #else
14+ go ([&box] {
15+ #endif
1016 for (int i = 0 ; i < 10000 ; i++) {
1117 int *n = new int (i);
1218 printf (" fiber-%d: Push %d\r\n " , acl::fiber::self (), *n);
1319 box.push (n);
1420 acl::fiber::delay (1000 );
1521 }
16- };
22+ });
23+
1724
25+ acl::fiber::set_event_keepio (true );
26+ acl::fiber::set_event_oneshot (true );
1827
1928 go[&box] {
2029 while (true ) {
You can’t perform that action at this time.
0 commit comments