1/** 2 * \file 3 * \brief Simple Barrier test 4 */ 5 6/* 7 * Copyright (c) 2011, ETH Zurich. 8 * All rights reserved. 9 * 10 * This file is distributed under the terms in the attached LICENSE file. 11 * If you do not find this file, copies can be found by writing to: 12 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group. 13 */ 14 15#include <stdlib.h> 16#include <stdio.h> 17#include <assert.h> 18 19#include <barrelfish/barrelfish.h> 20#include <octopus/octopus.h> 21 22#include "common.h" 23 24int main(int argc, char *argv[]) 25{ 26 assert(argc >= 2); 27 errval_t err = SYS_ERR_OK; 28 oct_init(); 29 30 size_t wait_for = atoi(argv[1]); 31 char* record = NULL; 32 debug_printf("Barrier test with: %zu processes:\n", wait_for); 33 34 err = oct_barrier_enter("my_barrier", &record, wait_for); 35 if(err_is_ok(err)) { 36 debug_printf("Execute Barrier code section\n"); 37 debug_printf("Barrier record is: %s\n", record); 38 } 39 else { 40 DEBUG_ERR(err, "Barrier enter fail."); 41 abort(); 42 } 43 err = oct_barrier_leave(record); 44 ASSERT_ERR_OK(err); 45 46 debug_printf("Process no longer inside barrier.\n"); 47 48 free(record); 49 return EXIT_SUCCESS; 50} 51