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

Function acl_atomic_clock_alloc

lib_acl/src/stdlib/acl_atomic.c:217–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215};
216
217ACL_ATOMIC_CLOCK *acl_atomic_clock_alloc(void)
218{
219 ACL_ATOMIC_CLOCK *clk = (ACL_ATOMIC_CLOCK *)
220 acl_mycalloc(1, sizeof(ACL_ATOMIC_CLOCK));
221 struct timeval tv;
222
223 gettimeofday(&tv, NULL);
224
225 clk->atime = (long long) tv.tv_sec * 1000000 + (long long) tv.tv_usec;
226 clk->count = 0;
227 clk->users = 0;
228 clk->atime_atomic = acl_atomic_new();
229 clk->count_atomic = acl_atomic_new();
230 clk->users_atomic = acl_atomic_new();
231
232 acl_atomic_set(clk->atime_atomic, &clk->atime);
233 acl_atomic_set(clk->count_atomic, &clk->count);
234 acl_atomic_set(clk->users_atomic, &clk->users);
235
236 return clk;
237}
238
239void acl_atomic_clock_free(ACL_ATOMIC_CLOCK *clk)
240{

Callers 3

servers_startFunction · 0.85
servers_startFunction · 0.85
servers_startFunction · 0.85

Calls 3

acl_atomic_newFunction · 0.85
acl_atomic_setFunction · 0.85
gettimeofdayFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…