Exemple #1
0
int main()
{
	int qid;
	Msg_t ctrl_msg;
	long mtype;

	qid = CreateMQ(5000);
	if(qid < 0)
	{
		printf("q open fail\n");
		return -1;
	}
	
	while(1)
	{
		mtype = RecvCtrl(qid, &ctrl_msg);

		if(mtype > 0)
		{
			switch(ctrl_msg.type)
			{
				case MSG_SUPER_BLOCK:
					LoadSuperBlk(qid);
					break;
				case MSG_INODE_BITMAP:
					LoadInodeBM(qid);
					break;
				case MSG_BLOCK_BITMAP:
					LoadBlockBM(qid);
					break;
				default:
					printf("default\n");
			}
		}
	}
	RemoveMQ(qid);
	
	return 0;
}
Exemple #2
0
//##############################################################################
//##############################################################################
bool
RequestQueueListener::send_ack(const std::string &client_id, const Ack &ack)
{
    MessageQueue<> ackq { CreateMQ(ack_queue_prefix + client_id), cfg_->reader_ack_timeout(), 1000 };
    return ackq.send(ack.SerializeAsString());
}