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
critsec.h
Package: MF.zip [view]
Upload User: geng8029
Upload Date: 2021-01-30
Package Size: 187k
Code Size: 2k
Category:
Audio program
Development Platform:
Visual C++
- #pragma once
- namespace MediaFoundationSamples
- {
- //////////////////////////////////////////////////////////////////////////
- // CritSec
- // Description: Wraps a critical section.
- //////////////////////////////////////////////////////////////////////////
- class CritSec
- {
- private:
- CRITICAL_SECTION m_criticalSection;
- public:
- CritSec()
- {
- InitializeCriticalSection(&m_criticalSection);
- }
- ~CritSec()
- {
- DeleteCriticalSection(&m_criticalSection);
- }
- void Lock()
- {
- EnterCriticalSection(&m_criticalSection);
- }
- void Unlock()
- {
- LeaveCriticalSection(&m_criticalSection);
- }
- };
- //////////////////////////////////////////////////////////////////////////
- // AutoLock
- // Description: Provides automatic locking and unlocking of a
- // of a critical section.
- //
- // Note: The AutoLock object must go out of scope before the CritSec.
- //////////////////////////////////////////////////////////////////////////
- class AutoLock
- {
- private:
- CritSec *m_pCriticalSection;
- public:
- AutoLock(CritSec& crit)
- {
- m_pCriticalSection = &crit;
- m_pCriticalSection->Lock();
- }
- ~AutoLock()
- {
- m_pCriticalSection->Unlock();
- }
- };
- }; // namespace MediaFoundationSamples