44 #ifndef vtkSMPThreadLocal_h
45 #define vtkSMPThreadLocal_h
54 typedef std::vector<T> TLS;
55 typedef typename TLS::iterator TLSIter;
85 int tid = this->GetThreadID();
86 if (!this->Initialized[tid])
88 this->Internal[tid] = this->Exemplar;
89 this->Initialized[tid] =
true;
90 ++this->NumInitialized;
92 return this->Internal[tid];
100 return this->NumInitialized;
121 while(this->InitIter != this->EndIter)
142 return this->Iter == other.Iter;
147 return this->Iter != other.Iter;
162 std::vector<bool>::iterator InitIter;
163 std::vector<bool>::iterator EndIter;
172 TLSIter iter = this->Internal.begin();
173 std::vector<bool>::iterator iter2 =
174 this->Initialized.begin();
175 std::vector<bool>::iterator enditer =
176 this->Initialized.end();
179 while(iter2 != enditer)
189 retVal.InitIter = iter2;
190 retVal.EndIter = enditer;
202 retVal.InitIter = this->Initialized.end();
203 retVal.EndIter = this->Initialized.end();
204 retVal.Iter = this->Internal.end();
211 std::vector<bool> Initialized;
212 size_t NumInitialized;
217 this->Internal.resize(this->GetNumberOfThreads());
218 this->Initialized.resize(this->GetNumberOfThreads());
219 std::fill(this->Initialized.begin(),
220 this->Initialized.end(),
224 inline int GetNumberOfThreads()
229 inline int GetThreadID()
vtkSMPThreadLocal(const T &exemplar)
bool operator!=(const iterator &other)
bool operator==(const iterator &other)
A simple thread local implementation for sequential operations.