Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Eyescale/Lunchbox
Browse files Browse the repository at this point in the history
  • Loading branch information
tribal-tec committed May 1, 2012
2 parents d135cd2 + efdb424 commit a13dd7a
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions lunchbox/mtQueue.h
Expand Up @@ -46,18 +46,27 @@ namespace lunchbox
MTQueue( size_t maxSize = S ) : _maxSize( maxSize ) {}

/** Construct a copy of a queue. @version 1.0 */
MTQueue( const MTQueue< T, S >& from ) : _queue( from._queue ) {}
MTQueue( const MTQueue< T, S >& from ) { *this = from; }

/** Destruct this Queue. @version 1.0 */
~MTQueue() {}

/** Assign the values of another queue. @version 1.0 */
MTQueue< T, S >& operator = ( const MTQueue< T, S >& from )
{
_cond.lock();
_queue = from._queue;
_cond.signal();
_cond.unlock();
if( this != &from )
{
from._cond.lock();
std::deque< T > copy = from._queue;
const size_t maxSize = from._maxSize;
from._cond.unlock();

_cond.lock();
_maxSize = maxSize;
_queue.swap( copy );
_cond.signal();
_cond.unlock();
}
return *this;
}

Expand Down

0 comments on commit a13dd7a

Please sign in to comment.