root/juggler/tags/1.0.5/Threads/vjThreadKeySGI.h

Revision 7539, 7.2 kB (checked in by anonymous, 7 years ago)

This commit was manufactured by cvs2svn to create tag
'RELENG_1_0_5_RELEASE'.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
2  *
3  * VR Juggler is (C) Copyright 1998, 1999, 2000 by Iowa State University
4  *
5  * Original Authors:
6  *   Allen Bierbaum, Christopher Just,
7  *   Patrick Hartling, Kevin Meinert,
8  *   Carolina Cruz-Neira, Albert Baker
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Library General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU Library General Public
21  * License along with this library; if not, write to the
22  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23  * Boston, MA 02111-1307, USA.
24  *
25  * -----------------------------------------------------------------
26  * File:          $RCSfile$
27  * Date modified: $Date$
28  * Version:       $Revision$
29  * -----------------------------------------------------------------
30  *
31  *************** <auto-copyright.pl END do not edit this line> ***************/
32
33
34 /*
35  * --------------------------------------------------------------------------
36  * NOTES:
37  *    - This file (vjThreadKeySGI.h) MUST be included by vjThread.h, not the
38  *      other way around.
39  * --------------------------------------------------------------------------
40  */
41
42 #ifndef _VJ_THREAD_KEY_SGI_H_
43 #define _VJ_THREAD_KEY_SGI_H_
44 //#pragma once
45
46 #include <vjConfig.h>
47 #include <sys/types.h>
48
49 #include <Threads/vjThreadFunctor.h>
50
51 // Key destructor function type.
52 typedef vj_thread_func_t        vjKeyDestructor;
53
54 class vjThreadKeySGI {
55 public:
56     // -----------------------------------------------------------------------
57     //: Constructor.
58     // -----------------------------------------------------------------------
59     vjThreadKeySGI (vj_thread_func_t destructor, void* arg = 0) {
60         keycreate(destructor, arg);
61     }
62
63     // -----------------------------------------------------------------------
64     //: Constructor.
65     // -----------------------------------------------------------------------
66     vjThreadKeySGI ( vjBaseThreadFunctor* destructor) {
67         keycreate(destructor);
68     }
69
70     // -----------------------------------------------------------------------
71     //: Destructor.
72     // -----------------------------------------------------------------------
73     ~vjThreadKeySGI (void) {
74         keyfree();
75     }
76
77     // -----------------------------------------------------------------------
78     //: Allocate a <keyp> that is used to identify data that is specific to
79     //+ each thread in the process, is global to all threads in the process
80     //+ and is destroyed using the spcefied destructor function that takes a
81     //+ single argument.
82     //
83     //! PRE: None.
84     //! POST: A key is created and is associated with the specified
85     //+       destructor function and argument.
86     //
87     //! ARGS: dest_func - The destructor function for the key.  This uses
88     //+                   the functor data structure.
89     //! ARGS: arg - Argument to be passed to destructor (optional).
90     //
91     //! RETURNS:  0 - Successful completion
92     //! RETURNS: -1 - Error
93     //
94     //! NOTE: Use this routine to construct the key destructor function if
95     //+       it requires arguments.  Otherwise, use the two-argument
96     //+       version of keycreate().
97     // -----------------------------------------------------------------------
98     int
99     keycreate (vj_thread_func_t destructor, void* arg = 0) {
100         std::cerr << "vjThreadKeySGI::keycreate() not implemented yet!\n";
101
102         return -1;
103     }
104
105     // -----------------------------------------------------------------------
106     //: Allocates a <keyp> that is used to identify data that is specific to
107     //+ each thread in the process, is global to all threads in the process
108     //+ and is destroyed by the specified destructor function.
109     //
110     //! PRE: None.
111     //! POST: A key is created and is associated with the specified
112     //+       destructor function.
113     //
114     //! ARGS: desctructor - Procedure to be called to destroy a data value
115     //+                     associated with the key when the thread
116     //+                     terminates.
117     //
118     //! RETURNS:  0 - Successful completion
119     //! RETURNS: -1 - Error
120     // -----------------------------------------------------------------------
121     int
122     keycreate ( vjBaseThreadFunctor* destructor) {
123         std::cerr << "vjThreadKeySGI::keycreate() not implemented yet!\n";
124
125         return -1;
126     }
127
128     // -----------------------------------------------------------------------
129     //: Free up the key so that other threads may reuse it.
130     //
131     //! PRE: The specified key must have been properly created using the
132     //+      keycreate() member function.
133     //! POST: The specified key is destroyed using the destructor function
134     //+       previously associated with it, and its resources are freed.
135     //
136     //! RETURNS:  0 - Successful completion
137     //! RETURNS: -1 - Error
138     //
139     //! NOTE: This is not currently supported on HP-UX 10.20.
140     // -----------------------------------------------------------------------
141     int
142     keyfree (void) {
143         std::cerr << "vjThreadKeySGI::keyfree() not implemented yet!\n";
144
145         return -1;
146     }
147
148     // -----------------------------------------------------------------------
149     //: Bind value to the thread-specific data key, <key>, for the calling
150     //+ thread.
151     //
152     //! PRE: The specified key must have been properly created using the
153     //+      keycreate() member function.
154     //! POST: The specified value is associated with the key for the calling
155     //+       thread.
156     //
157     //! ARGS: value - Address containing data to be associated with the
158     //+               specified key for the current thread.
159     //
160     //! RETURNS:  0 - Successful completion
161     //! RETURNS: -1 - Error
162     // -----------------------------------------------------------------------
163     int
164     setspecific (void* value) {
165         std::cerr << "vjThreadKeySGI::setspecific() not implemented yet!\n";
166
167         return -1;
168     }
169
170     // -----------------------------------------------------------------------
171     //: Stores the current value bound to <key> for the calling thread into
172     //+ the location pointed to by <valuep>.
173     //
174     //! PRE: The specified key must have been properly created using the
175     //+      keycreate() member function.
176     //! POST: The value associated with the key is obtained and stored in the
177     //+       pointer valuep so that the caller may work with it.
178     //
179     //! ARGS: valuep - Address of the current data value associated with the
180     //+                key.
181     //
182     //! RETURNS:  0 - Successful completion
183     //! RETURNS: -1 - Error
184     // -----------------------------------------------------------------------
185     int
186     getspecific (void** valuep) {
187         std::cerr << "vjThreadKeySGI::getspecific() not implemented yet!\n";
188
189         return -1;
190     }
191
192 private:
193     int keyID;          //: Thread key ID
194 };
195
196 #endif  /* _VJ_THREAD_KEY_SGI_H_ */
Note: See TracBrowser for help on using the browser.