ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

pnp_list_lock.c
Go to the documentation of this file.
00001 /*
00002  * PROJECT:          ReactOS
00003  * LICENSE:          GPL - See COPYING in the top level directory
00004  * FILE:             base/services/audiosrv/list_lock.c
00005  * PURPOSE:          Audio Service Plug and Play list locking mechanism
00006  * COPYRIGHT:        Copyright 2007 Andrew Greenwood
00007  */
00008 
00009 #include "audiosrv.h"
00010 
00011 static HANDLE audio_device_list_lock = NULL;
00012 
00013 BOOL
00014 InitializeAudioDeviceListLock()
00015 {
00016     /* The security stuff is to make sure the mutex can be grabbed by
00017        other processes - is this the best idea though ??? */
00018 
00019     SECURITY_DESCRIPTOR security_descriptor;
00020     SECURITY_ATTRIBUTES security;
00021 
00022     InitializeSecurityDescriptor(&security_descriptor, SECURITY_DESCRIPTOR_REVISION);
00023     SetSecurityDescriptorDacl(&security_descriptor, TRUE, 0, FALSE);
00024 
00025     security.nLength = sizeof(SECURITY_ATTRIBUTES);
00026     security.lpSecurityDescriptor = &security_descriptor;
00027     security.bInheritHandle = FALSE;
00028 
00029     audio_device_list_lock = CreateMutex(&security,
00030                                          FALSE,
00031                                          AUDIO_LIST_LOCK_NAME);
00032 
00033     return ( audio_device_list_lock != NULL );
00034 }
00035 
00036 VOID
00037 KillAudioDeviceListLock()
00038 {
00039     CloseHandle(audio_device_list_lock);
00040     audio_device_list_lock = NULL;
00041 }
00042 
00043 VOID
00044 LockAudioDeviceList()
00045 {
00046     assert( audio_device_list_lock != NULL );
00047     WaitForSingleObject(audio_device_list_lock, INFINITE);
00048 }
00049 
00050 VOID
00051 UnlockAudioDeviceList()
00052 {
00053     assert( audio_device_list_lock != NULL );
00054     ReleaseMutex(audio_device_list_lock);
00055 }
00056 

Generated on Sat May 26 2012 04:16:34 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.