/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* *Process2waitsonsemaphore2andpoststosemaphore1.
*/ for (i = 0; i < iterations; i++) { if (PR_WaitSemaphore(sem2) == PR_FAILURE) {
fprintf(stderr, "PR_WaitSemaphore failed\n"); exit(1);
} if (*counter_addr == 2 * i + 1) { if (debug_mode) {
printf("process 2: counter = %d\n", *counter_addr);
}
} else {
fprintf(stderr, "process 2: counter should be %d but is %d\n", 2 * i + 1,
*counter_addr); exit(1);
}
(*counter_addr)++; if (PR_PostSemaphore(sem1) == PR_FAILURE) {
fprintf(stderr, "PR_PostSemaphore failed\n"); exit(1);
}
} if (PR_DetachSharedMemory(shm, counter_addr) == PR_FAILURE) {
fprintf(stderr, "PR_DetachSharedMemory failed\n"); exit(1);
} if (PR_CloseSharedMemory(shm) == PR_FAILURE) {
fprintf(stderr, "PR_CloseSharedMemory failed\n"); exit(1);
} if (PR_CloseSemaphore(sem1) == PR_FAILURE) {
fprintf(stderr, "PR_CloseSemaphore failed\n");
} if (PR_CloseSemaphore(sem2) == PR_FAILURE) {
fprintf(stderr, "PR_CloseSemaphore failed\n");
}
printf("PASS\n"); return0;
}
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.15Bemerkung:
(vorverarbeitet am 2026-09-28)
¤
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.