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

Function main

example_echocli.cpp:182–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182int main(int argc,char *argv[])
183{
184 stEndPoint endpoint;
185 endpoint.ip = argv[1];
186 endpoint.port = atoi(argv[2]);
187 int cnt = atoi( argv[3] );
188 int proccnt = atoi( argv[4] );
189
190 struct sigaction sa;
191 sa.sa_handler = SIG_IGN;
192 sigaction( SIGPIPE, &sa, NULL );
193
194 for(int k=0;k<proccnt;k++)
195 {
196
197 pid_t pid = fork();
198 if( pid > 0 )
199 {
200 continue;
201 }
202 else if( pid < 0 )
203 {
204 break;
205 }
206 for(int i=0;i<cnt;i++)
207 {
208 stCoRoutine_t *co = 0;
209 co_create( &co,NULL,readwrite_routine, &endpoint);
210 co_resume( co );
211 }
212 co_eventloop( co_get_epoll_ct(),0,0 );
213
214 exit(0);
215 }
216 return 0;
217}
218/*./example_echosvr 127.0.0.1 10000 100 50*/

Callers

nothing calls this directly

Calls 5

sigactionClass · 0.85
co_createFunction · 0.85
co_resumeFunction · 0.85
co_eventloopFunction · 0.85
co_get_epoll_ctFunction · 0.85

Tested by

no test coverage detected