Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения

Class reliable_message_queue

Boost , Chapter 1. Boost.Log v2 , Utilities

Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Class reliable_message_queue

boost::log::ipc::reliable_message_queue — A reliable interprocess message queue.

Synopsis

// In header: <boost/log/utility/ipc/reliable_message_queue.hpp>

class reliable_message_queue {
public:
  // types
  typedef uint32_t size_type;  // Queue message size type. 
  // Result codes for various operations on the queue. 
  enum operation_result { succeeded, no_space, aborted };
  // Interprocess queue overflow policies. 
  enum overflow_policy { block_on_overflow, fail_on_overflow, 
                         throw_on_overflow };
  // construct/copy/destruct
  reliable_message_queue() noexcept;
  reliable_message_queue(open_mode::create_only_tag, object_name const &, 
                         uint32_t, size_type, 
                         overflow_policy = block_on_overflow, 
                         permissions const & = permissions());
  reliable_message_queue(open_mode::open_or_create_tag, object_name const &, 
                         uint32_t, size_type, 
                         overflow_policy = block_on_overflow, 
                         permissions const & = permissions());
  reliable_message_queue(open_mode::open_only_tag, object_name const &, 
                         overflow_policy = block_on_overflow, 
                         permissions const & = permissions());
  template<typename... Args> explicit reliable_message_queue(Args const &...);
  reliable_message_queue(reliable_message_queue &&) noexcept;
  reliable_message_queue & operator=(reliable_message_queue &&) noexcept;
  ~reliable_message_queue();
  // public member functions
  void swap(reliable_message_queue &) noexcept;
  void create(object_name const &, uint32_t, size_type, 
              overflow_policy = block_on_overflow, 
              permissions const & = permissions());
  void open_or_create(object_name const &, uint32_t, size_type, 
                      overflow_policy = block_on_overflow, 
                      permissions const & = permissions());
  void open(object_name const &, overflow_policy = block_on_overflow, 
            permissions const & = permissions());
  bool is_open() const noexcept;
  void clear();
  object_name const & name() const;
  uint32_t capacity() const;
  size_type block_size() const;
  void stop_local();
  void reset_local();
  void close() noexcept;
  operation_result send(void const *, size_type);
  bool try_send(void const *, size_type);
  operation_result receive(void *, size_type, size_type &);
  template<typename ElementT, size_type SizeV> 
    operation_result receive(ElementT(&), size_type &);
  template<typename ContainerT> operation_result receive(ContainerT &);
  bool try_receive(void *, size_type, size_type &);
  template<typename ElementT, size_type SizeV> 
    bool try_receive(ElementT(&), size_type &);
  template<typename ContainerT> bool try_receive(ContainerT &);
  // friend functions
  friend void swap(reliable_message_queue &, reliable_message_queue &) noexcept;
  // public static functions
  static void remove(object_name const &);
};

Description

Очередь реализует надежный односторонний канал передачи сообщений от одного или нескольких авторов одному читателю. Формат сообщений определяется пользователем и должен соответствовать всем авторам и читателю. Очередь не обеспечивает какой-либо конкретный формат сообщений, кроме того, что они должны быть предоставлены в виде смежного массива байтов.

Очередь внутри использует совместно используемое хранилище, идентифицированное object_name (имя очереди). См. документацию object_name для получения подробной информации об ограничениях, налагаемых на имена объектов.

Очередь хранения организована как фиксированное количество блоков фиксированного размера. Размер блока должен быть целочисленной мощностью 2 и выражается в байтах. Каждое письменное сообщение вместе с некоторыми метаданными, добавленными в очередь, потребляет целое число блоков. Каждое прочитанное сообщение, полученное читателем, высвобождает блоки, выделенные для этого сообщения. Таким образом, максимальный размер сообщения немного меньше, чем пропускная способность очереди. Для эффективности рекомендуется выбрать размер блока, достаточно большой, чтобы разместить большинство сообщений, которые будут переданы через очередь.

Очередь считается пустой, когда нет сообщений (все блоки свободны). Очередь считается полной в точке очереди сообщения, когда не хватает свободных блоков для размещения сообщения.

Очередь надежна тем, что она не упадет успешно отправленными сообщениями, которые не получены читателем, кроме случая, когда непустая очередь уничтожается последним пользователем. Если сообщение не может быть поставлено в очередь автором, потому что очередь заполнена, очередь может либо заблокировать автора, либо вернуть ошибку, либо бросить исключение, в зависимости от политики, указанной при создании очереди. Политика носит объектно-локальный характер, т.е. разные авторы и читатели могут иметь разную политику переполнения.

Если очередь пуста, и читатель пытается очертить сообщение, оно будет блокироваться до тех пор, пока сообщение не будет поставлено в очередь писателем.

Заблокированный читатель или автор может быть разблокирован по телефону stop_local. После того, как этот метод называется, все потоки, заблокированные на этом конкретном объекте, высвобождаются и возвращаются Operation_result::aborted. Другие случаи очереди (в текущих или других процессах) не затрагиваются. Для восстановления нормального функционирования очереди после stop_local Позвоните пользователю, чтобы вызвать reset_local.

Очередь не гарантирует какого-либо конкретного порядка получаемых сообщений от разных авторов. Сообщения, отправленные конкретным автором, будут получены в порядке отправки.

Методы этого класса не являются безвредными, если не указано иное.

reliable_message_queue public construct/copy/destruct

  1. reliable_message_queue() noexcept;

    Default constructor. The method constructs an object that is not associated with any message queue.

    Постусловия:

    is_open() == false

  2. Конструктор. Метод используется для построения объекта и создания соответствующей очереди сообщений. Построенный объект будет в рабочем состоянии, если очередь сообщения будет успешно создана.

    Параметры:

    block_size

    Сисите в байтах блока распределения. Должно быть мощность 2.

    capacity

    Максимальное количество блоков распределения, которые может удерживать очередь.

    name

    Название очереди сообщений, с которыми следует связываться.

    oflow_policy

    Queueue behaviour policy in case of overflow.

    perms

    Получить разрешения для соответствующей очереди сообщений.

    Почтовые условия:

    is_open() == true

    Constructor. The method is used to construct an object and create the associated message queue. The constructed object will be in running state if the message queue is successfully created.

    Parameters:

    block_size

    Size in bytes of allocation block. Must be a power of 2.

    capacity

    Maximum number of allocation blocks the queue can hold.

    name

    Name of the message queue to be associated with.

    oflow_policy

    Queue behavior policy in case of overflow.

    perms

    Access permissions for the associated message queue.

    Постусловия:

    is_open() == true

    [ORIG_END] -->
  3. reliable_message_queue(open_mode::open_or_create_tag, 
                           object_name const & name, uint32_t capacity, 
                           size_type block_size, 
                           overflow_policy oflow_policy = block_on_overflow, 
                           permissions const & perms = permissions());

    Constructor. The method is used to construct an object and create or open the associated message queue. The constructed object will be in running state if the message queue is successfully created or opened. If the message queue that is identified by the name already exists then the other queue parameters are ignored. The actual queue parameters can be obtained with accessors from the constructed object.

    Parameters:

    block_size

    Size in bytes of allocation block. Must be a power of 2.

    capacity

    Maximum number of allocation blocks the queue can hold.

    name

    Name of the message queue to be associated with.

    oflow_policy

    Queue behavior policy in case of overflow.

    perms

    Access permissions for the associated message queue.

    Постусловия:

    is_open() == true

  4. Конструктор. Метод используется для построения объекта и открытия существующей очереди сообщений. Построенный объект будет в рабочем состоянии, если очередь сообщения будет успешно открыта.

    Параметры:

    name

    Название очереди сообщений, с которыми следует связываться.

    oflow_policy

    Queueue behaviour policy in case of overflow.

    perms

    Получить разрешения для соответствующей очереди сообщений. Разрешения будут использоваться только в том случае, если реализация очереди должна создавать системные объекты во время работы. Этот параметр в настоящее время не используется на системах POSIX.

    Почтовые условия:

    is_open() == true

    Constructor. The method is used to construct an object and open the existing message queue. The constructed object will be in running state if the message queue is successfully opened.

    Parameters:

    name

    Name of the message queue to be associated with.

    oflow_policy

    Queue behavior policy in case of overflow.

    perms

    Access permissions for the associated message queue. The permissions will only be used if the queue implementation has to create system objects while operating. This parameter is currently not used on POSIX systems.

    Постусловия:

    is_open() == true

    [ORIG_END] -->
  5. template<typename... Args> 
      explicit reliable_message_queue(Args const &... args);

    Constructor with named parameters. The method is used to construct an object and create or open the associated message queue. The constructed object will be in running state if the message queue is successfully created.

    The following named parameters are accepted:

    • open_mode - One of the open mode tags: open_mode::create_only, open_mode::open_only or open_mode::open_or_create.

    • Имя - Имя очереди сообщений, с которой следует ассоциироваться.

    • емкость - максимальное количество блоков распределения, которые может удерживать очередь. Используется только при создании очереди.

    • block_size - Размер в байтах блока распределения. Это должна быть сила 2. Используется только при создании очереди.

    • overflow_policy - Политика поведения в случае переполнения см. overflow_policy.

    • Разрешения - Разрешения доступа для соответствующей очереди сообщений.

    Постусловия:

    is_open() == true

  6. Составник. Метод перемещает объект из other. После вызова построенный объект становится other, а other остается в по умолчанию построенном состоянии.

    Параметры:

    that

    Объект перемещения.

    Move constructor. The method move-constructs an object from other. After the call, the constructed object becomes other, while other is left in default constructed state.

    Parameters:

    that

    The object to be moved.

    [ORIG_END] -->
  7. reliable_message_queue & operator=(reliable_message_queue && that) noexcept;

    Move assignment operator. If the object is associated with a message queue, close() is first called and the precondition to calling close() applies. After the call, the object becomes that while that is left in default constructed state.

    Parameters:

    that

    The object to be moved.

    Returns:

    A reference to the assigned object.

  8. ~reliable_message_queue();

    Destructor. Calls close().

reliable_message_queue public member functions

  1. void swap(reliable_message_queue & that) noexcept;

    The method swaps the object with that.

    Parameters:

    that

    The other object to swap with.

  2. void create(object_name const & name, uint32_t capacity, size_type block_size, 
                overflow_policy oflow_policy = block_on_overflow, 
                permissions const & perms = permissions());

    The method creates the message queue to be associated with the object. After the call, the object will be in running state if a message queue is successfully created.

    Parameters:

    block_size

    Size in bytes of allocation block. Must be a power of 2.

    capacity

    Maximum number of allocation blocks the queue can hold.

    name

    Name of the message queue to be associated with.

    oflow_policy

    Queue behavior policy in case of overflow.

    perms

    Access permissions for the associated message queue.

    Requires:

    is_open() == false

    Постусловия:

    is_open() == true

  3. void open_or_create(object_name const & name, uint32_t capacity, 
                        size_type block_size, 
                        overflow_policy oflow_policy = block_on_overflow, 
                        permissions const & perms = permissions());

    The method creates or opens the message queue to be associated with the object. After the call, the object will be in running state if a message queue is successfully created or opened. If the message queue that is identified by the name already exists then the other queue parameters are ignored. The actual queue parameters can be obtained with accessors from this object after this method returns.

    Parameters:

    block_size

    Size in bytes of allocation block. Must be a power of 2.

    capacity

    Maximum number of allocation blocks the queue can hold.

    name

    Name of the message queue to be associated with.

    oflow_policy

    Queue behavior policy in case of overflow.

    perms

    Access permissions for the associated message queue.

    Requires:

    is_open() == false

    Постусловия:

    is_open() == true

  4. Метод открывает существующую очередь сообщения для связи с объектом. После вызова объект будет в запущенном состоянии, если очередь сообщения будет успешно открыта.

    Параметры:

    name

    Название очереди сообщений, с которыми следует связываться.

    oflow_policy

    Queueue behaviour policy in case of overflow.

    perms

    Получить разрешения для соответствующей очереди сообщений. Разрешения будут использоваться только в том случае, если реализация очереди должна создавать системные объекты во время работы. Этот параметр в настоящее время не используется на системах POSIX.

    Требования:

    is_open() == false

    Почтовые условия:

    is_open() == true

    The method opens the existing message queue to be associated with the object. After the call, the object will be in running state if a message queue is successfully opened.

    Parameters:

    name

    Name of the message queue to be associated with.

    oflow_policy

    Queue behavior policy in case of overflow.

    perms

    Access permissions for the associated message queue. The permissions will only be used if the queue implementation has to create system objects while operating. This parameter is currently not used on POSIX systems.

    Requires:

    is_open() == false

    Постусловия:

    is_open() == true

    [ORIG_END] -->
  5. bool is_open() const noexcept;

    Tests whether the object is associated with any message queue.

    Returns:

    true if the object is associated with a message queue, and false otherwise.

  6. Этот метод освобождает связанную очередь сообщения. Разрешены одновременные звонки на этот метод, send(), try_send(), receive(), try_receive() и stop_local().

    is_open() == true

    Требования:

    This method empties the associated message queue. Concurrent calls to this method, send(), try_send(), receive(), try_receive(), and stop_local() are allowed.

    Requires:

    is_open() == true

    [ORIG_END] -->
  7. object_name const & name() const;

    The method returns the name of the associated message queue.

    Requires:

    is_open() == true

    Returns:

    Name of the associated message queue

  8. uint32_t capacity() const;

    The method returns the maximum number of allocation blocks the associated message queue can hold. Note that the returned value may be different from the corresponding value passed to the constructor or open_or_create(), for the message queue may not have been created by this object.

    Requires:

    is_open() == true

    Returns:

    Maximum number of allocation blocks the associated message queue can hold.

  9. size_type block_size() const;

    The method returns the allocation block size, in bytes. Each message in the associated message queue consumes an integer number of allocation blocks. Note that the returned value may be different from the corresponding value passed to the constructor or open_or_create(), for the message queue may not have been created by this object.

    Requires:

    is_open() == true

    Returns:

    Allocation block size, in bytes.

  10. Метод пробуждает все нити, которые блокируются в вызовах send() или receive(). Эти звонки затем возвращают false с errno EINTR. Обратите внимание, что метод не блокируется до тех пор, пока разбуденные нити не вернулись из send() или receive(). Необходимы другие средства для обеспечения того, чтобы звонки на send() или receive() вернулись, например, присоединяясь к потокам, которые могут блокировать звонки.

    Также метод помещает объект в остановленное состояние. Когда в остановленном состоянии, звонки в send() или receive() сразу же вернутся с возвратным значением false и errno EINTR, когда они в противном случае блокируют в рабочем состоянии.

    Разрешены постоянные звонки на этот метод, send(), try_send(), receive(), try_receive() и clear().

    is_open() == true

    Требования:

    The method wakes up all threads that are blocked in calls to send() or receive(). Those calls would then return false with errno EINTR. Note that, the method does not block until the woken-up threads have actually returned from send() or receive(). Other means is needed to ensure that calls to send() or receive() have returned, e.g., joining the threads that might be blocking on the calls.

    The method also puts the object in stopped state. When in stopped state, calls to send() or receive() will return immediately with return value false and errno EINTR when they would otherwise block in running state.

    Concurrent calls to this method, send(), try_send(), receive(), try_receive(), and clear() are allowed.

    Requires:

    is_open() == true

    [ORIG_END] -->
  11. void reset_local();

    The method puts the object in running state where calls to send() or receive() may block. This method is not thread-safe.

    Requires:

    is_open() == true

  12. Метод рассеивает связанную очередь сообщения, если таковая имеется. Никакие другие нити не должны использовать этот объект, прежде чем называть этот метод. Метод stop_local() может быть использован, чтобы иметь любые потоки, которые в настоящее время заблокированы в возврате send() или receive(), и предотвратить дальнейшие звонки к ним от блокировки. Обычно, прежде чем называть этот метод, сначала позвоните stop_local(), а затем присоединяйтесь ко всем потокам, которые могут блокировать send() или receive(), чтобы убедиться, что они вернулись с вызовов. Связанная очередь сообщения разрушается, если объект представляет последнюю выдающуюся ссылку на него.

    Почтовые условия:

    is_open() == false

    The method disassociates the associated message queue, if any. No other threads should be using this object before calling this method. The stop_local() method can be used to have any threads currently blocked in send() or receive() return, and prevent further calls to them from blocking. Typically, before calling this method, one would first call stop_local() and then join all threads that might be blocking on send() or receive() to ensure that they have returned from the calls. The associated message queue is destroyed if the object represents the last outstanding reference to it.

    Постусловия:

    is_open() == false

    [ORIG_END] -->
  13. Метод посылает сообщение в очередь сообщения. Когда объект находится в запущенном состоянии и очередь не имеет свободного места для сообщения, метод либо блокирует, либо бросает исключение, в зависимости от политики переполнения, которая была указана на открытии/создании очереди. Если политика блокировки действует, блокировка может быть прервана вызовом stop_local(), в этом случае метод возвращает operation_result::aborted. Когда объект уже находится в остановленном состоянии, метод не блокирует, а возвращает сразу с возвратным значением operation_result::aborted.

    Можно отправить пустое сообщение, передав 0 параметру message_size.

    Разрешены одновременные звонки на send(), try_send(), receive(), try_receive(), stop_local() и clear().

    Throws: std::logic_error в случае, если размер сообщения превышает пропускную способность очереди, system_error в случае, если уроженческий метод ОС не работает.

    Параметры:

    message_data

    Данные сообщения для отправки. Игнорировано, когда message_size является 0.

    message_size

    Сетите данные сообщения в байтах. Если размер больше, чем соответствующая емкость очереди сообщений, std::logic_error исключение выбрасывается.

    Требования:

    is_open() == true

    The method sends a message to the associated message queue. When the object is in running state and the queue has no free space for the message, the method either blocks or throws an exception, depending on the overflow policy that was specified on the queue opening/creation. If blocking policy is in effect, the blocking can be interrupted by calling stop_local(), in which case the method returns operation_result::aborted. When the object is already in the stopped state, the method does not block but returns immediately with return value operation_result::aborted.

    It is possible to send an empty message by passing 0 to the parameter message_size.

    Concurrent calls to send(), try_send(), receive(), try_receive(), stop_local(), and clear() are allowed.

    Throws: std::logic_error in case if the message size exceeds the queue capacity, system_error in case if a native OS method fails.

    Parameters:

    message_data

    The message data to send. Ignored when message_size is 0.

    message_size

    Size of the message data in bytes. If the size is larger than the associated message queue capacity, an std::logic_error exception is thrown.

    Requires:

    is_open() == true

    [ORIG_END] -->
  14. bool try_send(void const * message_data, size_type message_size);

    The method performs an attempt to send a message to the associated message queue. The method is non-blocking, and always returns immediately. boost::system::system_error is thrown for errors resulting from native operating system calls. Note that it is possible to send an empty message by passing 0 to the parameter message_size. Concurrent calls to send(), try_send(), receive(), try_receive(), stop_local(), and clear() are allowed.

    Throws: std::logic_error in case if the message size exceeds the queue capacity, system_error in case if a native OS method fails.

    Parameters:

    message_data

    The message data to send. Ignored when message_size is 0.

    message_size

    Size of the message data in bytes. If the size is larger than the maximum size allowed by the associated message queue, an std::logic_error exception is thrown.

    Requires:

    is_open() == true

    Returns:

    true if the message is successfully sent, and false otherwise (e.g., when the queue is full).

  15. operation_result 
    receive(void * buffer, size_type buffer_size, size_type & message_size);

    The method takes a message from the associated message queue. When the object is in running state and the queue is empty, the method blocks. The blocking is interrupted when stop_local() is called, in which case the method returns operation_result::aborted. When the object is already in the stopped state and the queue is empty, the method does not block but returns immediately with return value operation_result::aborted.

    Concurrent calls to send(), try_send(), receive(), try_receive(), stop_local(), and clear() are allowed.

    Parameters:

    buffer

    The memory buffer to store the received message in.

    buffer_size

    The size of the buffer, in bytes.

    message_size

    Receives the size of the received message, in bytes.

    Requires:

    is_open() == true

  16. template<typename ElementT, size_type SizeV> 
      operation_result receive(ElementT(&) buffer, size_type & message_size);

    The method takes a message from the associated message queue. When the object is in running state and the queue is empty, the method blocks. The blocking is interrupted when stop_local() is called, in which case the method returns operation_result::aborted. When the object is already in the stopped state and the queue is empty, the method does not block but returns immediately with return value operation_result::aborted.

    Concurrent calls to send(), try_send(), receive(), try_receive(), stop_local(), and clear() are allowed.

    Parameters:

    buffer

    The memory buffer to store the received message in.

    message_size

    Receives the size of the received message, in bytes.

    Requires:

    is_open() == true

  17. Метод принимает сообщение из соответствующей очереди сообщений. Когда объект находится в рабочем состоянии и очередь пуста, метод блокирует. Блокировка прерывается, когда называется stop_local(), в этом случае метод возвращается operation_result::aborted. Когда объект уже находится в остановленном состоянии и очередь пуста, метод не блокирует, а возвращает сразу с возвратным значением operation_result::aborted.

    .

    Разрешены одновременные звонки на send(), try_send(), receive(), try_receive(), stop_local() и clear().

    Параметры:

    container

    Контейнер для хранения полученного сообщения. Контейнер должен иметь тип значения char, signed char или unsigned char и поддерживать вставку элементов в конце.

    Требования:

    is_open() == true

    The method takes a message from the associated message queue. When the object is in running state and the queue is empty, the method blocks. The blocking is interrupted when stop_local() is called, in which case the method returns operation_result::aborted. When the object is already in the stopped state and the queue is empty, the method does not block but returns immediately with return value operation_result::aborted.

    Concurrent calls to send(), try_send(), receive(), try_receive(), stop_local(), and clear() are allowed.

    Parameters:

    container

    The container to store the received message in. The container should have value type of char, signed char or unsigned char and support inserting elements at the end.

    Requires:

    is_open() == true

    [ORIG_END] -->
  18. Метод выполняет попытку взять сообщение из соответствующей очереди сообщений. Метод не блокирует, и всегда возвращается сразу.

    Разрешены одновременные звонки на send(), try_send(), receive(), try_receive(), stop_local() и clear().

    Параметры:

    buffer

    буфер памяти для хранения полученного сообщения.

    buffer_size

    Размер буфера, в байтах.

    message_size

    Получает размер полученного сообщения, в байтах.

    Требования:

    is_open() == true

    Возвращение:

    true если сообщение успешно получено, и false в противном случае (например, когда очередь пуста).

    The method performs an attempt to take a message from the associated message queue. The method is non-blocking, and always returns immediately.

    Concurrent calls to send(), try_send(), receive(), try_receive(), stop_local(), and clear() are allowed.

    Parameters:

    buffer

    The memory buffer to store the received message in.

    buffer_size

    The size of the buffer, in bytes.

    message_size

    Receives the size of the received message, in bytes.

    Requires:

    is_open() == true

    Returns:

    true if a message is successfully received, and false otherwise (e.g., when the queue is empty).

    [ORIG_END] -->
  19. Метод выполняет попытку взять сообщение из соответствующей очереди сообщений. Метод не блокирует, и всегда возвращается сразу.

    Разрешены одновременные звонки на send(), try_send(), receive(), try_receive(), stop_local() и clear().

    Параметры:

    buffer

    буфер памяти для хранения полученного сообщения.

    message_size

    Получает размер полученного сообщения, в байтах.

    Требования:

    is_open() == true

    Возвращение:

    true если сообщение успешно получено, и false в противном случае (например, когда очередь пуста).

    The method performs an attempt to take a message from the associated message queue. The method is non-blocking, and always returns immediately.

    Concurrent calls to send(), try_send(), receive(), try_receive(), stop_local(), and clear() are allowed.

    Parameters:

    buffer

    The memory buffer to store the received message in.

    message_size

    Receives the size of the received message, in bytes.

    Requires:

    is_open() == true

    Returns:

    true if a message is successfully received, and false otherwise (e.g., when the queue is empty).

    [ORIG_END] -->
  20. template<typename ContainerT> bool try_receive(ContainerT & container);

    The method performs an attempt to take a message from the associated message queue. The method is non-blocking, and always returns immediately.

    Concurrent calls to send(), try_send(), receive(), try_receive(), stop_local(), and clear() are allowed.

    Parameters:

    container

    The container to store the received message in. The container should have value type of char, signed char or unsigned char and support inserting elements at the end.

    Requires:

    is_open() == true

    Returns:

    true if a message is successfully received, and false otherwise (e.g., when the queue is empty).

reliable_message_queue friend functions

  1. friend void swap(reliable_message_queue & a, reliable_message_queue & b) noexcept;
    Swaps the two reliable_message_queue objects.

reliable_message_queue public static functions

  1. Метод освобождает общесистемные ресурсы, связанные с очередей межпроцессов с поставленным именем. Очередь, указанная указанным именем, не должна открываться в любом процессе в точке этого звонка. После этого вызова удается создать новую очередь с указанным именем.

    Этот звонок может быть полезным для восстановления от более раннего процесса неправильного поведения (например, крушение без надлежащего закрытия очереди сообщения). В этом случае ресурсы, выделенные для межпроцессной очереди, могут оставаться выделенными после того, как последний процесс закрыл очередь, что, в свою очередь, может помешать созданию новой очереди с таким же названием. Позвонив этому методу перед созданием очереди, приложение может попытаться обеспечить его запуск с чистого листа.

    На некоторых платформах ресурсы, связанные с очередей, автоматически воспроизводятся операционной системой, когда последний процесс использования этих ресурсов заканчивается (даже если он заканчивается аномально). На этих платформах этот вызов может быть безымянным. Тем не менее, переносной код должен по-прежнему называть этот метод в соответствующих местах, чтобы обеспечить совместимость с другими платформами и будущими версиями библиотеки, что может изменить реализацию очереди.

    Параметры:

    name

    Название очереди сообщения должно быть удалено.

    The method frees system-wide resources, associated with the interprocess queue with the supplied name. The queue referred to by the specified name must not be opened in any process at the point of this call. After this call succeeds a new queue with the specified name can be created.

    This call can be useful to recover from an earlier process misbehavior (e.g. a crash without properly closing the message queue). In this case resources allocated for the interprocess queue may remain allocated after the last process closed the queue, which in turn may prevent creating a new queue with the same name. By calling this method before creating a queue the application can attempt to ensure it starts with a clean slate.

    On some platforms resources associated with the queue are automatically reclaimed by the operating system when the last process using those resources terminates (even if it terminates abnormally). On these platforms this call may be a no-op. However, portable code should still call this method at appropriate places to ensure compatibility with other platforms and future library versions, which may change implementation of the queue.

    Parameters:

    name

    Name of the message queue to be removed.

    [ORIG_END] -->

PrevUpHomeNext

Статья Class reliable_message_queue раздела Chapter 1. Boost.Log v2 Utilities может быть полезна для разработчиков на c++ и boost.




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: Utilities ::


реклама


©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru

Время компиляции файла: 2024-08-30 11:47:00
2025-07-04 15:44:31/0.010151863098145/0