diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-03-24 02:27:47 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-03-26 11:43:54 -0500 |
commit | 621d9e5c413e561293d7484b93882d985b3fe15f (patch) | |
tree | 638f3d75761c121d9a8fb50b52a12a6686c5ac5c /pki/base/tps/src/include/httpClient/httpc/ThreadPool.h | |
parent | 40d3643b8d91886bf210aa27f711731c81a11e49 (diff) | |
download | pki-621d9e5c413e561293d7484b93882d985b3fe15f.tar.gz pki-621d9e5c413e561293d7484b93882d985b3fe15f.tar.xz pki-621d9e5c413e561293d7484b93882d985b3fe15f.zip |
Removed unnecessary pki folder.
Previously the source code was located inside a pki folder.
This folder was created during svn migration and is no longer
needed. This folder has now been removed and the contents have
been moved up one level.
Ticket #131
Diffstat (limited to 'pki/base/tps/src/include/httpClient/httpc/ThreadPool.h')
-rw-r--r-- | pki/base/tps/src/include/httpClient/httpc/ThreadPool.h | 159 |
1 files changed, 0 insertions, 159 deletions
diff --git a/pki/base/tps/src/include/httpClient/httpc/ThreadPool.h b/pki/base/tps/src/include/httpClient/httpc/ThreadPool.h deleted file mode 100644 index 389d42606..000000000 --- a/pki/base/tps/src/include/httpClient/httpc/ThreadPool.h +++ /dev/null @@ -1,159 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ -/** BEGIN COPYRIGHT BLOCK - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * Copyright (C) 2007 Red Hat, Inc. - * All rights reserved. - * END COPYRIGHT BLOCK **/ - -#ifndef __THREAD_POOL_H -#define __THREAD_POOL_H - -#ifdef HAVE_CONFIG_H -#ifndef AUTOTOOLS_CONFIG_H -#define AUTOTOOLS_CONFIG_H - -/* Eliminate warnings when using Autotools */ -#undef PACKAGE_BUGREPORT -#undef PACKAGE_NAME -#undef PACKAGE_STRING -#undef PACKAGE_TARNAME -#undef PACKAGE_VERSION - -#include <config.h> -#endif /* AUTOTOOLS_CONFIG_H */ -#endif /* HAVE_CONFIG_H */ - -/** - * ThreadPool.h 1.000 06/12/2002 - * - * A worker thread pool. - * - * @author Surendra Rajam - * @version 1.000, 06/12/2002 - */ - -class EXPORT_DECL ThreadPool { - friend class WorkerThread; -public: - /** - * Constructor - creates the pool with default values - * - * @param name name of the threadpool - */ - ThreadPool(const char* name); - - /** - * Constructor - * - * @param name name of the threadpool - * @param min minimum threads in the pool - * @param max maximum threads that can be created - * @param timeout timeout for each thread - */ - ThreadPool(const char* name, int min, int max, int timeout); - - /** - * Destructor - */ - virtual ~ThreadPool(); - -public: - - /** - * Initializes the thread pool with minimum threads - */ - void Init(); - - /** - * Shutdown the thread pool - */ - void Shutdown(); - - /** - * Adds a task for future execution - * - * @param task a task to execute - */ - void AddTask(ScheduledTask* task); - - /** - * Executes the task immediately - * - * @param task a task to execute - */ - void ExecuteTask(ScheduledTask* task); - - /** - * Gets the number of active threads in the pool - * - * @return number of active threads - */ - int GetThreads(); - - /** - * Gets the number of pending tasks in the list - * - * @return number of pending tasks - */ - int GetPendingTasks(); - - /** - * Function to start a NSPR thread - */ - static void StartWorkerThread(void* arg); - -private: - /** - * Initializes constructor params - */ - void ConstructorInit(const char* name, int min, int max, int timeout); - - /** - * Creates a new thread - */ - void CreateNewThread(); - - /** - * Notify one of the threads waiting on a condition - */ - void Notify(); - -private: - char* m_name; - TaskList* m_taskList; - - int m_minThreads; - int m_maxThreads; - int m_timeout; - - int m_threads; - int m_activeThreads; - - PRBool m_threadWait; - PRLock* m_threadLock; - PRCondVar* m_threadCondVar; - - PRBool m_newThreadInitialized; - PRLock* m_newThreadLock; - PRCondVar* m_newThreadCondVar; - - bool m_keepRunning; -}; - -#endif // __THREAD_POOL_H - |