]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/interprocess/example/comp_doc_message_queueB.cpp
1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2006-2012. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 // See http://www.boost.org/libs/interprocess for documentation.
9 //////////////////////////////////////////////////////////////////////////////
10 #include <boost/interprocess/detail/config_begin.hpp>
12 #include <boost/interprocess/ipc/message_queue.hpp>
16 using namespace boost::interprocess
;
21 //Open a message queue.
23 (open_only
//only create
24 ,"message_queue" //name
27 unsigned int priority
;
28 message_queue::size_type recvd_size
;
31 for(int i
= 0; i
< 100; ++i
){
33 mq
.receive(&number
, sizeof(number
), recvd_size
, priority
);
34 if(number
!= i
|| recvd_size
!= sizeof(number
))
38 catch(interprocess_exception
&ex
){
39 message_queue::remove("message_queue");
40 std::cout
<< ex
.what() << std::endl
;
43 message_queue::remove("message_queue");
47 #include <boost/interprocess/detail/config_end.hpp>