Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: barrier.cc | |
4 | // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
5 | // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
6 | // | |
7 | // The above named program is free software; you can redistribute it and/or | |
8 | // modify it under the terms of the GNU General Public | |
9 | // License version 2 as published by the Free Software Foundation. | |
10 | // | |
11 | // The above named program is distributed in the hope that it will be | |
12 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | // General Public License for more details. | |
15 | // | |
16 | // You should have received a copy of the GNU General Public | |
17 | // License along with this work; if not, write to the Free Software | |
18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | // | |
20 | // ========== Copyright Header End ============================================ | |
21 | /* | |
22 | * Copyright (C) 2001 Sun Microsystems, Inc. | |
23 | * All rights reserved. | |
24 | */ | |
25 | #pragma ident "@(#)1.2 02/05/23 barrier.cc" | |
26 | ||
27 | #include <sys/types.h> | |
28 | #include <assert.h> | |
29 | #include <stdio.h> | |
30 | ||
31 | #include <synch.h> | |
32 | #include <thread.h> | |
33 | ||
34 | #include "barrier.h" | |
35 | ||
36 | extern uint64_t global_tick; | |
37 | ||
38 | void barrier_init(struct barrier *bp, int count) | |
39 | { | |
40 | bp->maxcount = count; | |
41 | bp->sbp = &bp->sb[0]; | |
42 | bp->p_global_tick = &global_tick; | |
43 | ||
44 | for (int i = 0; i < 2; i++) { | |
45 | bp->sb[i].cv = 1; | |
46 | bp->sb[i].runners = count; | |
47 | } | |
48 | } |