'\" t .\" Title: zmq_atomic_counter_destroy .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 09/06/2020 .\" Manual: 0MQ Manual .\" Source: 0MQ 4.3.1 .\" Language: English .\" .TH "ZMQ_ATOMIC_COUNTER_D" "3" "09/06/2020" "0MQ 4\&.3\&.1" "0MQ 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" zmq_atomic_counter_destroy \- destroy an atomic counter .SH "SYNOPSIS" .sp \fBvoid zmq_atomic_counter_destroy (void **counter_p);\fR .SH "DESCRIPTION" .sp The \fIzmq_atomic_counter_destroy\fR function destroys an atomic counter and nullifies its reference\&. Pass the address of an atomic counter (void **) rather than the counter itself\&. You must destroy all counters that you create, to avoid memory leakage\&. This function uses platform specific atomic operations\&. .SH "RETURN VALUE" .sp The \fIzmq_atomic_counter_destroy()\fR function has no return value\&. .SH "EXAMPLE" .PP \fBTest code for atomic counters\fR. .sp .if n \{\ .RS 4 .\} .nf void *counter = zmq_atomic_counter_new (); assert (zmq_atomic_counter_value (counter) == 0); assert (zmq_atomic_counter_inc (counter) == 0); assert (zmq_atomic_counter_inc (counter) == 1); assert (zmq_atomic_counter_inc (counter) == 2); assert (zmq_atomic_counter_value (counter) == 3); assert (zmq_atomic_counter_dec (counter) == 1); assert (zmq_atomic_counter_dec (counter) == 1); assert (zmq_atomic_counter_dec (counter) == 0); zmq_atomic_counter_set (counter, 2); assert (zmq_atomic_counter_dec (counter) == 1); assert (zmq_atomic_counter_dec (counter) == 0); zmq_atomic_counter_destroy (&counter); return 0; .fi .if n \{\ .RE .\} .sp .SH "SEE ALSO" .sp \fBzmq_atomic_counter_new\fR(3) \fBzmq_atomic_counter_set\fR(3) \fBzmq_atomic_counter_inc\fR(3) \fBzmq_atomic_counter_dec\fR(3) \fBzmq_atomic_counter_value\fR(3) .SH "AUTHORS" .sp This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&.