0N/A * The contents of this file are subject to the terms 0N/A * of the Common Development and Distribution License 0N/A * (the "License"). You may not use this file except 0N/A * in compliance with the License. 0N/A * You can obtain a copy of the license at 0N/A * See the License for the specific language governing 0N/A * permissions and limitations under the License. 0N/A * When distributing Covered Code, include this CDDL 0N/A * HEADER in each file and include the License file at 0N/A * add the following below this CDDL HEADER, with the 0N/A * fields enclosed by brackets "[]" replaced with your 0N/A * own identifying information: Portions Copyright [yyyy] 0N/A * [name of copyright owner] 0N/A * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 0N/A * Use is subject to license terms. 0N/A * using lock primitives alone for synchronisation. Threads are arranged in a 0N/A * ring. Each thread has two locks of its own on which it blocks, and is able 0N/A * to manipulate the two locks belonging to the thread which follows it in the 0N/A * The number of threads (nthreads) is specified by the generic libMicro -P/-T 0N/A * options. With nthreads == 1 (the default) the uncontended case can be timed. 0N/A * The main logic is generic and allows any simple blocking API to be tested. 0N/A * The API-specific component is clearly indicated. 0N/A * API-specific code BEGINS here 0N/A " [-s] (force PTHREAD_PROCESS_SHARED)\n" 0N/A "notes: thread cascade using pthread_mutexes\n");
0N/A * API-specific code ENDS here 0N/A /* lock index asignment for us and them */ 0N/A /* straight-thru connection to them */ 0N/A /* cross-over connection to them */ 0N/A /* block their first move */ 0N/A /* wait to be unblocked (id == 0 will not block) */ 0N/A /* allow them to block us again */ 0N/A /* block their next + 1 move */ 0N/A /* unblock their next move */ 0N/A /* wait for them to unblock us */ 0N/A /* repeat with locks reversed */ 0N/A /* finish batch with nothing blocked */