~ubuntu-branches/ubuntu/vivid/atlas/vivid

« back to all changes in this revision

Viewing changes to src/pthreads/misc/ATL_init_node.c

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot
  • Date: 2013-06-11 15:58:16 UTC
  • mfrom: (1.1.3 upstream)
  • mto: (2.2.21 experimental)
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: package-import@ubuntu.com-20130611155816-b72z8f621tuhbzn0
Tags: upstream-3.10.1
Import upstream version 3.10.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* ---------------------------------------------------------------------
2
 
 *
3
 
 * -- Automatically Tuned Linear Algebra Software (ATLAS)
4
 
 *    (C) Copyright 2000 All Rights Reserved
5
 
 *
6
 
 * -- ATLAS routine -- Version 3.2 -- December 25, 2000
7
 
 *
8
 
 * Author         : Antoine P. Petitet
9
 
 * Originally developed at the University of Tennessee,
10
 
 * Innovative Computing Laboratory, Knoxville TN, 37996-1301, USA.
11
 
 *
12
 
 * ---------------------------------------------------------------------
13
 
 *
14
 
 * -- Copyright notice and Licensing terms:
15
 
 *
16
 
 *  Redistribution  and  use in  source and binary forms, with or without
17
 
 *  modification, are  permitted provided  that the following  conditions
18
 
 *  are met:
19
 
 *
20
 
 * 1. Redistributions  of  source  code  must retain the above copyright
21
 
 *    notice, this list of conditions and the following disclaimer.
22
 
 * 2. Redistributions in binary form must reproduce  the above copyright
23
 
 *    notice,  this list of conditions, and the  following disclaimer in
24
 
 *    the documentation and/or other materials provided with the distri-
25
 
 *    bution.
26
 
 * 3. The name of the University,  the ATLAS group,  or the names of its
27
 
 *    contributors  may not be used to endorse or promote products deri-
28
 
 *    ved from this software without specific written permission.
29
 
 *
30
 
 * -- Disclaimer:
31
 
 *
32
 
 * THIS  SOFTWARE  IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33
 
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,  INCLUDING,  BUT NOT
34
 
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
35
 
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY
36
 
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,  INDIRECT, INCIDENTAL, SPE-
37
 
 * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
38
 
 * TO,  PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
39
 
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEO-
40
 
 * RY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  (IN-
41
 
 * CLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
42
 
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
 
 *
44
 
 * ---------------------------------------------------------------------
45
 
 */
46
 
/*
47
 
 * Include files
48
 
 */
49
 
#include "atlas_ptmisc.h"
50
 
 
51
 
PT_TREE_T ATL_init_node
52
 
(
53
 
   unsigned int               NODE,
54
 
   PT_TREE_T                  LEFT,
55
 
   PT_TREE_T                  RIGHT,
56
 
   PT_DATA_T                  DATA,
57
 
   PT_FUN_VAL_T               * VAL,
58
 
   PT_FUN_T                   FUN,
59
 
   PT_FUN_ARG_T               ARG
60
 
)
61
 
{
62
 
/*
63
 
 * Purpose
64
 
 * =======
65
 
 *
66
 
 * ATL_init_node creates and returns a node of the recursion tree.
67
 
 *
68
 
 * Arguments
69
 
 * =========
70
 
 *
71
 
 * NODE    (input)                       unsigned int
72
 
 *         On entry, NODE specifies the node number.
73
 
 *
74
 
 * LEFT    (input)                       PT_TREE_T
75
 
 *         On entry, LEFT specifies the left child of the current node.
76
 
 *
77
 
 * RIGHT   (input)                       PT_TREE_T
78
 
 *         On entry, RIGHT specifies  the  right  child  of the  current
79
 
 *         node.
80
 
 *
81
 
 * DATA    (input)                       PT_DATA_T
82
 
 *         On entry, DATA  is a pointer to the data associated with this
83
 
 *         current node.
84
 
 *
85
 
 * VAL     (input)                       PT_FUN_VAL_T
86
 
 *         On entry, VAL  is  a pointer to the memory location where the
87
 
 *         the  function  associated  with  this  node should return its
88
 
 *         value.
89
 
 *
90
 
 * FUN     (input)                       PT_FUN_T
91
 
 *         On entry, FUN  is  a  pointer to the function associated with
92
 
 *         this current node.
93
 
 *
94
 
 * ARG     (input)                       PT_FUN_ARG_T
95
 
 *         On entry, ARG  is  a  pointer to  data  structure  containing
96
 
 *         the arguments to be passed to the function FUN.
97
 
 *
98
 
 * ---------------------------------------------------------------------
99
 
 */
100
 
/*
101
 
 * .. Local Variables ..
102
 
 */
103
 
   PT_TREE_T                  t = NULL;
104
 
/* ..
105
 
 * .. Executable Statements ..
106
 
 *
107
 
 */
108
 
   t = (PT_TREE_T)malloc( sizeof( PT_NODE_T ) ); ATL_assert( t != NULL );
109
 
 
110
 
   ATL_assert(!pthread_mutex_init( &(t->mutex), NULL ));
111
 
   ATL_assert(!pthread_cond_init ( &(t->cond),  NULL ));
112
 
   t->left  = LEFT; t->right = RIGHT; t->node = NODE; t->count = 0;
113
 
   t->data  = DATA; t->val   = VAL;   t->fun  = FUN;  t->arg   = ARG;
114
 
 
115
 
   return( t );
116
 
/*
117
 
 * End of ATL_init_node
118
 
 */
119
 
}