/home/aconway/svn/qpid/cpp/src/qpid/broker/AutoDelete.h

00001 #ifndef _AutoDelete_
00002 #define _AutoDelete_
00003 /*
00004  *
00005  * Licensed to the Apache Software Foundation (ASF) under one
00006  * or more contributor license agreements.  See the NOTICE file
00007  * distributed with this work for additional information
00008  * regarding copyright ownership.  The ASF licenses this file
00009  * to you under the Apache License, Version 2.0 (the
00010  * "License"); you may not use this file except in compliance
00011  * with the License.  You may obtain a copy of the License at
00012  * 
00013  *   http://www.apache.org/licenses/LICENSE-2.0
00014  * 
00015  * Unless required by applicable law or agreed to in writing,
00016  * software distributed under the License is distributed on an
00017  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00018  * KIND, either express or implied.  See the License for the
00019  * specific language governing permissions and limitations
00020  * under the License.
00021  *
00022  */
00023 #include <iostream>
00024 #include <queue>
00025 #include "qpid/sys/Monitor.h"
00026 #include "BrokerQueue.h"
00027 #include "QueueRegistry.h"
00028 #include "qpid/sys/Thread.h"
00029 
00030 namespace qpid {
00031     namespace broker{
00032         class AutoDelete : private qpid::sys::Runnable {
00033             qpid::sys::Mutex lock;            
00034             qpid::sys::Monitor monitor;            
00035             std::queue<Queue::shared_ptr> queues;
00036             QueueRegistry* const registry;
00037             uint32_t period;
00038             volatile bool stopped;
00039             qpid::sys::Thread runner;
00040             
00041             Queue::shared_ptr const pop();
00042             void process();
00043             virtual void run();
00044 
00045         public:
00046             AutoDelete(QueueRegistry* const registry, uint32_t period);
00047             void add(Queue::shared_ptr const);
00048             void start();
00049             void stop();
00050         };
00051     }
00052 }
00053 
00054 
00055 #endif

Generated on Tue Apr 17 14:22:03 2007 for Qpid by  doxygen 1.4.7