Equalizer  1.4.1
worker.ipp
00001 
00002 /* Copyright (c) 2011-2012, Stefan Eilemann <eile@eyescale.ch>
00003  *                    2012, Daniel Nachbaur <danielnachbaur@gmail.com>
00004  *
00005  * This library is free software; you can redistribute it and/or modify it under
00006  * the terms of the GNU Lesser General Public License version 2.1 as published
00007  * by the Free Software Foundation.
00008  *
00009  * This library is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00012  * details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public License
00015  * along with this library; if not, write to the Free Software Foundation, Inc.,
00016  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00017  */
00018 
00019 #include "worker.h"
00020 
00021 #include "iCommand.h"
00022 
00023 namespace co
00024 {
00025 template< class Q > void WorkerThread< Q >::run()
00026 {
00027     while( !stopRunning( ))
00028     {
00029         ICommand command = _commands.pop();
00030         LBASSERT( command.isValid( ));
00031 
00032         if( !command( ))
00033         {
00034             LBABORT( "Error handling " << command );
00035         }
00036 
00037         while( _commands.isEmpty( ))
00038             if( !notifyIdle( )) // nothing to do
00039                 break;
00040     }
00041 
00042     _commands.flush();
00043     LBINFO << "Leaving worker thread " << lunchbox::className( this ) << std::endl;
00044 }
00045 
00046 }
Generated on Mon Nov 26 2012 14:41:50 for Equalizer 1.4.1 by  doxygen 1.7.6.1