/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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/. */
/* * TODO: create a macro to generate the six lines of code that are repeated * for every test. Also rewrite the statement * result = result | ((EXPRESSION) ? 0 : 1); * as * result |= !(EXPRESSION);
*/
int main(int argc, char** argv) {
PRInt32 rv, oldval, test, result = 0;
PRFileDesc* output = PR_GetSpecialFD(PR_StandardOutput);
/***********************/ /* Test the functions. */ /***********************/
/* set to a different value */
oldval = test = -2;
rv = PR_ATOMIC_SET(&test, 2);
result = result | (((rv == -2) && (test == 2)) ? 0 : 1);
PR_fprintf(output, "PR_ATOMIC_SET(%d, %d) == %d: %s\n", oldval, 2, rv,
((rv == -2) && (test == 2)) ? "PASSED" : "FAILED");
/* set to the same value */
oldval = test = -2;
rv = PR_ATOMIC_SET(&test, -2);
result = result | (((rv == -2) && (test == -2)) ? 0 : 1);
PR_fprintf(output, "PR_ATOMIC_SET(%d, %d) == %d: %s\n", oldval, -2, rv,
((rv == -2) && (test == -2)) ? "PASSED" : "FAILED");
PR_fprintf(output, "Atomic operations test %s\n",
(result == 0) ? "PASSED" : "FAILED"); return result;
} /* main */
/* atomic.c */
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.10Bemerkung:
(vorverarbeitet am 2026-06-05)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.