[#BloombergLP-ball-Log-obtainMessageBuffer-04]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/ball.adoc[ball]::xref:BloombergLP/ball/Log.adoc[Log]::obtainMessageBuffer
:relfileprefix: ../../../
:mrdocs:

Obtain exclusive access to this thread&apos;s message&hyphen;formatting buffer&period;

== Synopsis

Declared in `&lt;ball&lowbar;log&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
char*
obtainMessageBuffer(
    xref:BloombergLP/bslmt/Mutex.adoc[bslmt::Mutex]** mutex,
    int* bufferSize);
----

== Description

Block until access to the buffer used for formatting messages in this thread of execution is available&period; Return the address of the modifiable buffer to which this thread of execution has exclusive access, load the address of the mutex that protects the buffer into the specified `&ast;mutex` address, and load the size (in bytes) of the buffer into the specified `bufferSize` address&period; The address remains valid, and the buffer remains locked by this thread of execution, until the `Log&colon;&colon;releaseMessageBuffer` method is called&period; The behavior is undefined if this thread of execution currently holds a lock on the buffer&period; Note that the buffer is intended to be used _only_ for formatting log messages immediately before a call to `Log&colon;&colon;logMessage`&semi; other use may adversely affect performance for the entire program&period;

== Return Value

address of this thread&apos;s exclusive message&hyphen;formatting buffer

== Parameters

[cols="1,4"]
|===
| Name| Description
| *mutex*
| address at which to store the buffer&hyphen;guarding mutex
| *bufferSize*
| address at which to store the buffer size in bytes
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
