summaryrefslogtreecommitdiff
path: root/ace/SV_Message_Queue.i
blob: 65c092136f7101c432bfe058d9c41531dbc22061 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* -*- C++ -*- */
// $Id$

// SV_Message_Queue.i

#include "ace/SV_Message_Queue.h"

// Open a message queue using the <external_id>.

ASYS_INLINE int
ACE_SV_Message_Queue::open (key_t external_id, int create, int perms)
{
  ACE_TRACE ("ACE_SV_Message_Queue::open");
  return this->internal_id_ = ACE_OS::msgget (external_id, create | perms);
}

// What does it mean to close a message queue?!

ASYS_INLINE int
ACE_SV_Message_Queue::close (void)
{
  ACE_TRACE ("ACE_SV_Message_Queue::close");
  this->internal_id_ = -1;
  return 1;
}

ASYS_INLINE int
ACE_SV_Message_Queue::control (int option, void *arg)
{
  ACE_TRACE ("ACE_SV_Message_Queue::control");
  return ACE_OS::msgctl (this->internal_id_, option, 
			 (msqid_ds *) arg);
}

ASYS_INLINE int
ACE_SV_Message_Queue::remove (void)
{
  ACE_TRACE ("ACE_SV_Message_Queue::remove");
  int result = this->control (IPC_RMID);
  this->internal_id_ = -1;
  return result;
}

ASYS_INLINE int
ACE_SV_Message_Queue::get_id (void) const
{
  ACE_TRACE ("ACE_SV_Message_Queue::get_id");
  return this->internal_id_;
}

ASYS_INLINE void
ACE_SV_Message_Queue::set_id (int id)
{
  ACE_TRACE ("ACE_SV_Message_Queue::set_id");
  this->internal_id_ = id;
}

ASYS_INLINE int
ACE_SV_Message_Queue::recv (ACE_SV_Message &mb, 
			    int length, 
			    long type, 
			    int mflags)
{
  ACE_TRACE ("ACE_SV_Message_Queue::recv");
  return ACE_OS::msgrcv (this->internal_id_, (void *) &mb, 
			 length, type, mflags);
}

ASYS_INLINE int
ACE_SV_Message_Queue::send (const ACE_SV_Message &mb, 
			    int length, 
			    int mflags)
{
  ACE_TRACE ("ACE_SV_Message_Queue::send");
  return ACE_OS::msgsnd (this->internal_id_, (void *) &mb,
			 length, mflags);
}