Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Which one you will use to implement critical section?

Answer Posted / svinto

Now sure what is asked but anyway:
1. If the question is how would you implement critical
section mechanism then the answer is to use a mutex.
2. If the question is to show how to use the critical
section then the following code fragment adresses that:
//
// Global variable or a member of some
// dynamically allocated structure, usualy within
// the data access to which it is protecting.
//
CRITICAL_SECTION cs;

VOID Init(VOID) {
InitializeCriticalSection( &cs );
}

VOID SomeCall(VOID) {
EnterCriticalSection( &cs );
//
// Thread-safe block of code protected by critical
section.
//
LeaveCriticalSection( &cs );
}

VOID
UnInit(VOID) {
DeleteCriticalSection( &cs );
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are types of threads?

1129


who among the following is responsible for establishing IS Audit function in the organisation?

1569


What is the default kill signal?

986


How do I kill a program without task manager?

936


Explain cannot copy (file name)- access is denied?

1107


explain readers-writers problem?

4085


What is thread safety?

968


How do we create threads?

1105


In window xp which are the threads. Actually I wanna know if ms word is a process which are the threads? Is spell check is a thread?

972


How to stop a thread?

937


Tell me when we browse internet system getting 500 error how will you solve the problem?

954


What are the different ways in which a thread can enter into waiting state?

1058


Can you explain too many times when I click on a sentence a caption comes on grr a pop up blocker maybe blockiing--however I have pushed the turn off pop upblocker. This only happens on google it does not happen on att.net?

921


Purposes, features and functions of windows 98 and xp. i am struggling with this because i have to compare their strenths and weaknesses, please can i get help?

3971


What are the different identifier states of a thread?

971