Mixe for Privacy and Anonymity in the Internet
CAThreadList.hpp
Go to the documentation of this file.
00001 /*
00002 Copyright (c) The JAP-Team, JonDos GmbH
00003 
00004 All rights reserved.
00005 
00006 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00007 
00008     * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
00009     * Redistributions in binary form must reproduce the above copyright notice,
00010        this list of conditions and the following disclaimer in the documentation and/or
00011        other materials provided with the distribution.
00012     * Neither the name of the University of Technology Dresden, Germany, nor the name of
00013        the JonDos GmbH, nor the names of their contributors may be used to endorse or
00014        promote products derived from this software without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00017 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00018 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00019 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
00020 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00021 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00022 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00023 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00024 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00025 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00026 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027 */
00028 #ifndef CATHREADLIST_H_
00029 #define CATHREADLIST_H_
00030 
00034 #if defined (DEBUG) && !defined(ONLY_LOCAL_PROXY)
00035 struct thread_list_entry
00036 {
00037   CAThread* tle_thread;
00038   struct thread_list_entry *tle_next;
00039 };
00040 
00041 typedef struct thread_list_entry thread_list_entry_t;
00042 
00043 /* Just a simple list implementation to get hold of all created threads */
00044 class CAThreadList
00045 {
00046 
00047 public:
00048   CAThreadList();
00049   virtual ~CAThreadList();
00050   
00051   SINT32  put(const CAThread* const thread);
00052   SINT32  remove(const CAThread* const thread);
00053   //CAThread* get(CAThread *thread);
00054   void showAll() const;
00055   UINT32 getSize() const
00056     {
00057       return m_Size;
00058     }
00059   
00060 private:
00061   
00062   void      removeAll();
00063   
00064   UINT32 m_Size;
00065   thread_list_entry_t* m_pHead;
00066   CAMutex* m_pListLock;
00067 };
00068 
00069 #endif /*CATHREADLIST_H_*/
00070 #endif //DEBUG