���ն�����Ϣ���������߳�
| 10 | |
| 11 | // ���ն�����Ϣ���������߳� |
| 12 | static 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 | |
| 42 | static void usage(const char* procname) |
| 43 | { |