<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<refentry id="create_message_ex"> <!-- ID for references -->

<refmeta>
<refentrytitle>create_message_ex</refentrytitle> <!-- title shown in references -->
<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->

<refnamediv>
<refname>create_message_ex</refname> <!-- function name -->
<refpurpose>create and initialize message</refpurpose> <!-- short function description -->
</refnamediv>

<refsynopsisdiv><funcsynopsis>
<funcsynopsisinfo>
#include &lt;cds/msg_queue.h&gt; <!-- included headers -->
</funcsynopsisinfo>

<funcprototype> <!-- function prototype -->
  <funcdef>mq_message_t *<function>create_message_ex</function></funcdef>
  <paramdef>int <parameter>data_len</parameter></paramdef>
</funcprototype>

</funcsynopsis></refsynopsisdiv>

<refsect1><title>Description</title>

<para>Allocates message with data of given size
(<parameter>data_len</parameter>) using <function>cds_malloc</function>. It
initializes message content so it will be freed automatically. 
Pointer to allocated data should be obtained by 
<function>get_message_data</function>.
</para>

<para>Messages created by <function>create_message_ex</function> 
should be freed using <function>message_free</function>.</para>

<para>Unremoved messages created this way are freed automatically in
<function>msg_queue_destroy</function> using <function>free_message</function>.
</para>


</refsect1>

<refsect1><title>Return value</title>
<para>
<!-- return value description -->
Returns NULL on error, pointer to initialized message structure otherwise.
</para>
</refsect1>

<refsect1><title>See Also</title>
<para>
<xref linkend="create_message"/>, <xref linkend="init_message_ex"/>
<!-- references to other pages -->
</para>
</refsect1>

</refentry> 

