MCPcopy Create free account
hub / github.com/Tencent/libco / main

Function main

example_poll.cpp:180–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178 return 0;
179}
180int main(int argc,char *argv[])
181{
182 vector<task_t> v;
183 for(int i=1;i<argc;i+=2)
184 {
185 task_t task = { 0 };
186 SetAddr( argv[i],atoi(argv[i+1]),task.addr );
187 v.push_back( task );
188 }
189
190//------------------------------------------------------------------------------------
191 printf("--------------------- main -------------------\n");
192 vector<task_t> v2 = v;
193 poll_routine( &v2 );
194 printf("--------------------- routine -------------------\n");
195
196 for(int i=0;i<10;i++)
197 {
198 stCoRoutine_t *co = 0;
199 vector<task_t> *v2 = new vector<task_t>();
200 *v2 = v;
201 co_create( &co,NULL,poll_routine,v2 );
202 printf("routine i %d\n",i);
203 co_resume( co );
204 }
205
206 co_eventloop( co_get_epoll_ct(),0,0 );
207
208 return 0;
209}
210//./example_poll 127.0.0.1 12365 127.0.0.1 12222 192.168.1.1 1000 192.168.1.2 1111
211

Callers

nothing calls this directly

Calls 6

poll_routineFunction · 0.85
co_createFunction · 0.85
co_resumeFunction · 0.85
co_eventloopFunction · 0.85
co_get_epoll_ctFunction · 0.85
SetAddrFunction · 0.70

Tested by

no test coverage detected