Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
chxavmutex.h
Package: 142_61_thumb_advanced.rar [view]
Upload User: dangjiwu
Upload Date: 2013-07-19
Package Size: 42019k
Code Size: 2k
Category:
Symbian
Development Platform:
Visual C++
- /*****************************************************************************
- * chxavmutex.h
- * ------------
- *
- * Synopsis:
- * This class is a C++ wrapper for the pthreads mutex primitive.
- *
- * Target:
- * Symbian OS
- *
- *
- * (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
- *
- *****************************************************************************/
- #ifndef _chxavmutex_h_
- #define _chxavmutex_h_
- // Symbian includes...
- #include <e32base.h>
- #include <e32cons.h>
- #include <e32std.h>
- #include "bsthread/thread_error.h"
- //
- // bsMutex class
- //
- class CHXAvMutex {
- public:
- friend class bsConditionVar;
- CHXAvMutex ();
- ~CHXAvMutex ();
- void Lock ();
- void Unlock ();
- bool TryLock ();
- private:
- CHXAvMutex (const CHXAvMutex& m); // disallow copies
- void operator= (const CHXAvMutex& m); // disallow copies
- RMutex m_cs;
- };
- //
- // bsMutex methods
- //
- inline
- bsMutex::bsMutex ()
- {
- // create a process-relative, local mutex
- TInt ret = m_cs.CreateLocal();
- if (ret != KErrNone)
- bsThreadError (ret);
- }
- inline
- bsMutex::~bsMutex ()
- {
- m_cs.Close();
- }
- inline
- void bsMutex::Lock ()
- {
- m_cs.Wait();
- }
- inline
- void bsMutex::Unlock ()
- {
- m_cs.Signal();
- }
- inline
- bool bsMutex::TryLock ()
- {
- //
- // XXXCBR -- this isn't right - we might get locked by another
- // thread after we check Count() but before we can Wait().
- //
- if (m_cs.Count() < 1)
- return false;
- else
- m_cs.Wait();
- return true;
- }
- #endif // _MUTEX_H_