47693af92e50a1ad81825eb01b7157a211269613mx * CDDL HEADER START
47693af92e50a1ad81825eb01b7157a211269613mx * The contents of this file are subject to the terms of the
47693af92e50a1ad81825eb01b7157a211269613mx * Common Development and Distribution License (the "License").
47693af92e50a1ad81825eb01b7157a211269613mx * You may not use this file except in compliance with the License.
47693af92e50a1ad81825eb01b7157a211269613mx * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
47693af92e50a1ad81825eb01b7157a211269613mx * See the License for the specific language governing permissions
47693af92e50a1ad81825eb01b7157a211269613mx * and limitations under the License.
47693af92e50a1ad81825eb01b7157a211269613mx * When distributing Covered Code, include this CDDL HEADER in each
47693af92e50a1ad81825eb01b7157a211269613mx * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
47693af92e50a1ad81825eb01b7157a211269613mx * If applicable, add the following below this CDDL HEADER, with the
47693af92e50a1ad81825eb01b7157a211269613mx * fields enclosed by brackets "[]" replaced with your own identifying
47693af92e50a1ad81825eb01b7157a211269613mx * information: Portions Copyright [yyyy] [name of copyright owner]
47693af92e50a1ad81825eb01b7157a211269613mx * CDDL HEADER END
47693af92e50a1ad81825eb01b7157a211269613mx * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
47693af92e50a1ad81825eb01b7157a211269613mx * Use is subject to license terms.
6f3e57ac9d0b054c3169579f3422080b8ba10105mx * Atomically decrement a counter, but only if it will remain
6f3e57ac9d0b054c3169579f3422080b8ba10105mx * positive (>=0) afterwards.
6f3e57ac9d0b054c3169579f3422080b8ba10105mx /* ATOMICALLY */
75d94465dbafa487b716482dc36d5150a4ec9853Josef 'Jeff' Sipek } while (atomic_cas_64(count_p, oldval, newval) != oldval);
6f3e57ac9d0b054c3169579f3422080b8ba10105mx * Atomically increment a counter
6f3e57ac9d0b054c3169579f3422080b8ba10105mx /* ATOMICALLY */
75d94465dbafa487b716482dc36d5150a4ec9853Josef 'Jeff' Sipek } while (atomic_cas_64(count_p, oldval, newval) != oldval);
6f3e57ac9d0b054c3169579f3422080b8ba10105mx * Atomically shift a 32-bit word left, returning
6f3e57ac9d0b054c3169579f3422080b8ba10105mx * the value it had *before* the shift was applied
6f3e57ac9d0b054c3169579f3422080b8ba10105mx /* ATOMICALLY */