[Aptitude-svn-commit] r4040 - in branches/aptitude-0.3/aptitude: .
src/generic
Daniel Burrows
dburrows at costa.debian.org
Fri Sep 2 23:35:05 UTC 2005
Author: dburrows
Date: Fri Sep 2 23:35:02 2005
New Revision: 4040
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/generic/threads.h
Log:
Fix some silly compilation errors and make the broken-out box functions
inline to avoid link failures.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Fri Sep 2 23:35:02 2005
@@ -2,6 +2,11 @@
* src/generic/threads.h:
+ Fix some silly compilation errors; make all broken-out box
+ functions inline so they don't cause link failures.
+
+ * src/generic/threads.h:
+
Add a helper class to bootstrap noncopyable functors in threads,
and write an explicit specialization of threads::box for void
that acts as a "baton repository".
Modified: branches/aptitude-0.3/aptitude/src/generic/threads.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/threads.h (original)
+++ branches/aptitude-0.3/aptitude/src/generic/threads.h Fri Sep 2 23:35:02 2005
@@ -598,7 +598,7 @@
{
bool filled;
mutex m;
- condition c;
+ condition cond;
public:
box()
:filled(false)
@@ -666,6 +666,7 @@
};
template<typename T>
+ inline
T box<T>::take()
{
mutex::lock l(m);
@@ -680,7 +681,8 @@
return rval;
}
- void box<void>::take
+ inline
+ void box<void>::take()
{
mutex::lock l(m);
cond.wait(l, bool_ref_pred(filled));
@@ -688,6 +690,7 @@
}
template<typename T>
+ inline
bool box<T>::try_take(T &out)
{
mutex::lock l(m);
@@ -702,6 +705,7 @@
return false;
}
+ inline
bool box<void>::try_take()
{
mutex::lock l(m);
@@ -716,6 +720,7 @@
}
template<typename T>
+ inline
bool box<T>::timed_take(T &out, const timespec &until)
{
mutex::lock l(m);
@@ -730,6 +735,7 @@
return false;
}
+ inline
bool box<void>::timed_take(const timespec &until)
{
mutex::lock l(m);
@@ -744,6 +750,7 @@
}
template<typename T>
+ inline
void box<T>::put(const T &new_val)
{
mutex::lock l(m);
@@ -755,6 +762,7 @@
cond.wake_one();
}
+ inline
void box<void>::put()
{
mutex::lock l(m);
@@ -766,6 +774,7 @@
}
template<typename T>
+ inline
bool box<T>::try_put(const T &new_val)
{
mutex::lock l(m);
@@ -781,13 +790,14 @@
return false;
}
+ inline
bool box<void>::try_put()
{
mutex::lock l(m);
if(!filled)
{
- filed = true;
+ filled = true;
cond.wake_one();
return true;
}
@@ -796,6 +806,7 @@
}
template<typename T>
+ inline
bool box<T>::timed_put(const T &new_val, const timespec &until)
{
mutex::lock l(m);
@@ -811,6 +822,7 @@
return false;
}
+ inline
bool box<void>::timed_put(const timespec &until)
{
mutex::lock l(m);
@@ -827,6 +839,7 @@
template<typename T>
template<typename Mutator>
+ inline
void box<T>::update(const Mutator &m)
{
mutex::lock l(m);
@@ -896,5 +909,5 @@
};
}
-#endif
+#endif // THREADS_H
More information about the Aptitude-svn-commit
mailing list