2 #include "ace/Global_Macros.h"
3 #include "ace/OS_NS_sys_msg.h"
5 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
7 // Open a message queue using the <external_id>.
10 ACE_SV_Message_Queue::open (key_t external_id, int create, int perms)
12 ACE_TRACE ("ACE_SV_Message_Queue::open");
13 return this->internal_id_ = ACE_OS::msgget (external_id, create | perms);
16 // What does it mean to close a message queue?!
19 ACE_SV_Message_Queue::close ()
21 ACE_TRACE ("ACE_SV_Message_Queue::close");
22 this->internal_id_ = -1;
27 ACE_SV_Message_Queue::control (int option, void *arg)
29 ACE_TRACE ("ACE_SV_Message_Queue::control");
30 return ACE_OS::msgctl (this->internal_id_, option,
31 (struct msqid_ds *) arg);
35 ACE_SV_Message_Queue::remove ()
37 ACE_TRACE ("ACE_SV_Message_Queue::remove");
38 int const result = this->control (IPC_RMID);
39 this->internal_id_ = -1;
44 ACE_SV_Message_Queue::get_id () const
46 ACE_TRACE ("ACE_SV_Message_Queue::get_id");
47 return this->internal_id_;
51 ACE_SV_Message_Queue::set_id (int id)
53 ACE_TRACE ("ACE_SV_Message_Queue::set_id");
54 this->internal_id_ = id;
58 ACE_SV_Message_Queue::recv (ACE_SV_Message &mb,
63 ACE_TRACE ("ACE_SV_Message_Queue::recv");
64 return ACE_OS::msgrcv (this->internal_id_, (void *) &mb,
65 length, type, mflags);
69 ACE_SV_Message_Queue::send (const ACE_SV_Message &mb,
73 ACE_TRACE ("ACE_SV_Message_Queue::send");
74 return ACE_OS::msgsnd (this->internal_id_, (void *) &mb,
78 ACE_END_VERSIONED_NAMESPACE_DECL