MCPcopy Create free account
hub / github.com/acl-dev/acl / main

Function main

lib_acl_cpp/samples/tcp_pool/client/main.cpp:50–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50int main(int argc, char* argv[])
51{
52 int ch, cocurrent = 4, count = 1000, len = 10;
53 acl::string addr("127.0.0.1:8887");
54
55 while ((ch = getopt(argc, argv, "hs:c:n:l:")) > 0) {
56 switch (ch) {
57 case 'h':
58 usage(argv[0]);
59 return 0;
60 case 's':
61 addr = optarg;
62 break;
63 case 'c':
64 cocurrent = atoi(optarg);
65 break;
66 case 'n':
67 count = atoi(optarg);
68 break;
69 case 'l':
70 len = atoi(optarg);
71 break;
72 default:
73 usage(argv[0]);
74 return 0;
75 }
76 }
77
78 acl::tcp_pool pool(addr, count);
79
80 std::vector<acl::thread*> threads;
81 for (int i = 0; i < cocurrent; i++) {
82 acl::thread* thread = new client_thread(pool, count, len);
83 thread->set_detachable(false);
84 threads.push_back(thread);
85 thread->start();
86 }
87
88 for (std::vector<acl::thread*>::iterator it = threads.begin();
89 it != threads.end(); ++it) {
90
91 (*it)->wait();
92 delete *it;
93 }
94
95 return 0;
96}

Callers

nothing calls this directly

Calls 7

beginMethod · 0.80
usageFunction · 0.70
getoptFunction · 0.50
push_backMethod · 0.45
startMethod · 0.45
endMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…