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

Function main

lib_acl_cpp/samples/benchmark/client/main.cpp:121–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121int main(int argc, char* argv[])
122{
123 acl::acl_cpp_init();
124
125 acl::string addr("127.0.0.1:8888");
126 int ch;
127 bool separate = false;
128
129 while ((ch = getopt(argc, argv, "hs:n:l:p")) > 0 )
130 {
131 switch (ch)
132 {
133 case 'h':
134 usage(argv[0]);
135 return 0;
136 case 's':
137 addr = optarg;
138 break;
139 case 'n':
140 __max = atoi(optarg);
141 if (__max < 1)
142 __max = 1;
143 break;
144 case 'l':
145 __dlen = atoi(optarg);
146 if (__dlen <= 0)
147 __dlen = 10;
148 break;
149 case 'p':
150 separate = true;
151 break;
152 default:
153 usage(argv[0]);
154 return 0;
155 }
156 }
157
158 acl::socket_stream conn;
159 if (conn.open(addr, 30, 30) == false)
160 {
161 printf("connect %s error\r\n", addr.c_str());
162 return -1;
163 }
164
165 if (!separate)
166 {
167 handle_connection(conn);
168 return 0;
169 }
170
171 acl_pthread_attr_t attr;
172 acl_pthread_attr_init(&attr);
173 acl_pthread_attr_setdetachstate(&attr, 0);
174
175 acl_pthread_t tid_read, tid_write;
176
177 acl_pthread_create(&tid_read, &attr, thread_read, &conn);
178 acl_pthread_create(&tid_write, &attr, thread_write, &conn);

Callers

nothing calls this directly

Calls 10

acl_cpp_initFunction · 0.85
acl_pthread_attr_initFunction · 0.85
acl_pthread_createFunction · 0.85
acl_pthread_joinFunction · 0.85
usageFunction · 0.70
handle_connectionFunction · 0.70
getoptFunction · 0.50
openMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…