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

Function consumer

lib_acl_cpp/samples/beanstalk2/beanstalk.cpp:12–40  ·  view source on GitHub ↗

���ն�����Ϣ���������߳�

Source from the content-addressed store, hash-verified

10
11// ���ն�����Ϣ���������߳�
12static void consumer(void)
13{
14 acl::beanstalk conn(__addr, 10);
15 // ��ָ����Ϣ�����н�����Ϣ
16 if (conn.watch(__tube) == false)
17 {
18 printf("watch %s faile\r\n", __tube);
19 return;
20 }
21
22 acl::string buf;
23 unsigned long long id;
24
25 // ��ʱ����һ����Ϣ
26 if ((id = conn.reserve(buf)) == 0)
27 printf("reserve failed, error: %s\r\n", conn.get_error());
28 else
29 {
30 printf("id: %llu, buf: %s\r\n", id, buf.c_str());
31 conn.delete_id(id);
32 }
33
34 // ��������һ����Ϣ
35 if ((id = conn.reserve(buf, 1)) == 0)
36 printf("reserve failed, error: %s\r\n", conn.get_error());
37 else
38 printf("id: %llu, buf: %s\r\n", id, buf.c_str());
39
40}
41
42static void usage(const char* procname)
43{

Callers 1

mainFunction · 0.70

Calls 5

delete_idMethod · 0.80
watchMethod · 0.45
reserveMethod · 0.45
get_errorMethod · 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…