'\" t .\" Title: zmutex .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: 09/14/2016 .\" Manual: CZMQ Manual .\" Source: CZMQ 3.0.2 .\" Language: English .\" .TH "ZMUTEX" "3" "09/14/2016" "CZMQ 3\&.0\&.2" "CZMQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" zmutex \- working with mutexes (deprecated) .SH "SYNOPSIS" .sp .nf // Create a new mutex container CZMQ_EXPORT zmutex_t * zmutex_new (void); // Destroy a mutex container CZMQ_EXPORT void zmutex_destroy (zmutex_t **self_p); // Lock mutex CZMQ_EXPORT void zmutex_lock (zmutex_t *self); // Unlock mutex CZMQ_EXPORT void zmutex_unlock (zmutex_t *self); // Try to lock mutex CZMQ_EXPORT int zmutex_try_lock (zmutex_t *self); // Self test of this class CZMQ_EXPORT void zmutex_test (bool verbose); .fi .SH "DESCRIPTION" .sp The zmutex class provides a portable wrapper for mutexes\&. Please do not use this class to do multi\-threading\&. It is for the rare case where you absolutely need thread\-safe global state\&. This should happen in system code only\&. DO NOT USE THIS TO SHARE SOCKETS BETWEEN THREADS, OR DARK THINGS WILL HAPPEN TO YOUR CODE\&. .sp Please add @discuss section in \&.\&./src/zmutex\&.c\&. .SH "EXAMPLE" .PP \fBFrom zmutex_test method\fR. .sp .if n \{\ .RS 4 .\} .nf zmutex_t *mutex = zmutex_new (); assert (mutex); zmutex_lock (mutex); zmutex_unlock (mutex); zmutex_destroy (&mutex); .fi .if n \{\ .RE .\} .sp .SH "AUTHORS" .sp The czmq manual was written by the authors in the AUTHORS file\&. .SH "RESOURCES" .sp Main web site: \m[blue]\fB\%\fR\m[] .sp Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> .SH "COPYRIGHT" .sp Copyright (c) 1991\-2012 iMatix Corporation \-\- http://www\&.imatix\&.com Copyright other contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. .SH "NOTES" .IP " 1." 4 zeromq-dev@lists.zeromq.org .RS 4 \%mailto:zeromq-dev@lists.zeromq.org .RE