1/* 2 * Copyright (c) 2014 ETH Zurich. 3 * All rights reserved. 4 * 5 * This file is distributed under the terms in the attached LICENSE file. 6 * If you do not find this file, copies can be found by writing to: 7 * ETH Zurich D-INFK, Universitaetsstrasse 6, CH-8092 Zurich. Attn: Systems Group. 8 */ 9#include <bomp_internal.h> 10 11/* 12 * this functions implement the SINGLE construct 13 * 14 * #pragma omp single 15 * { 16 * body; 17 * } 18 * 19 * becomes 20 * 21 * if (GOMP_single_start ()) 22 * body; 23 * GOMP_barrier (); 24 * 25 * and 26 * 27 * #pragma omp single copyprivate(x) 28 * { 29 * body; 30 * } 31 * 32 * becomse 33 * 34 * datap = GOMP_single_copy_start (); 35 * if (datap == NULL) { 36 * body; 37 * data.x = x; 38 * GOMP_single_copy_end (&data); 39 * } else { 40 * x = datap->x; 41 * } 42 * GOMP_barrier (); 43 */ 44 45/* This function should return true for just the first thread */ 46bool GOMP_single_start(void) 47{ 48 struct bomp_thread_local_data *local = g_bomp_state->backend.get_tls(); 49 50 if (local == NULL || local->work->thread_id == 0) { 51 return true; 52 } 53 return false; 54} 55 56void *GOMP_single_copy_start (void) 57{ 58 assert(!"NYI"); 59 return NULL; 60} 61 62void GOMP_single_copy_end (void *data) 63{ 64 assert(!"NYI"); 65} 66