00001
00002
00003
00004
00005 #include "ace/Global_Macros.h"
00006 #include "ace/OS_NS_sys_msg.h"
00007
00008 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00009
00010
00011
00012 ACE_INLINE int
00013 ACE_SV_Message_Queue::open (key_t external_id, int create, int perms)
00014 {
00015 ACE_TRACE ("ACE_SV_Message_Queue::open");
00016 return this->internal_id_ = ACE_OS::msgget (external_id, create | perms);
00017 }
00018
00019
00020
00021 ACE_INLINE int
00022 ACE_SV_Message_Queue::close (void)
00023 {
00024 ACE_TRACE ("ACE_SV_Message_Queue::close");
00025 this->internal_id_ = -1;
00026 return 1;
00027 }
00028
00029 ACE_INLINE int
00030 ACE_SV_Message_Queue::control (int option, void *arg)
00031 {
00032 ACE_TRACE ("ACE_SV_Message_Queue::control");
00033 return ACE_OS::msgctl (this->internal_id_, option,
00034 (struct msqid_ds *) arg);
00035 }
00036
00037 ACE_INLINE int
00038 ACE_SV_Message_Queue::remove (void)
00039 {
00040 ACE_TRACE ("ACE_SV_Message_Queue::remove");
00041 int result = this->control (IPC_RMID);
00042 this->internal_id_ = -1;
00043 return result;
00044 }
00045
00046 ACE_INLINE int
00047 ACE_SV_Message_Queue::get_id (void) const
00048 {
00049 ACE_TRACE ("ACE_SV_Message_Queue::get_id");
00050 return this->internal_id_;
00051 }
00052
00053 ACE_INLINE void
00054 ACE_SV_Message_Queue::set_id (int id)
00055 {
00056 ACE_TRACE ("ACE_SV_Message_Queue::set_id");
00057 this->internal_id_ = id;
00058 }
00059
00060 ACE_INLINE ssize_t
00061 ACE_SV_Message_Queue::recv (ACE_SV_Message &mb,
00062 int length,
00063 long type,
00064 int mflags)
00065 {
00066 ACE_TRACE ("ACE_SV_Message_Queue::recv");
00067 return ACE_OS::msgrcv (this->internal_id_, (void *) &mb,
00068 length, type, mflags);
00069 }
00070
00071 ACE_INLINE int
00072 ACE_SV_Message_Queue::send (const ACE_SV_Message &mb,
00073 int length,
00074 int mflags)
00075 {
00076 ACE_TRACE ("ACE_SV_Message_Queue::send");
00077 return ACE_OS::msgsnd (this->internal_id_, (void *) &mb,
00078 length, mflags);
00079 }
00080
00081 ACE_END_VERSIONED_NAMESPACE_DECL