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 is wait() and notify()?

1051


How do you kill tasks?

989


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

1015


Which protocol is working behind dhcp server? And what exactly dora does?

1142


if a min thread has finished execution what happens ? a) it exits b) it wait for other threads c) becomes inactive ... etc etc

3486


Explain thread.sleep?

1015


How would you implement a thread pool?

1004


can any one know about NIC (National Informatics Centre) questions Patterns and full detail about written exam, and interview send to softshikha2005@yahoo.com.in Thank you

2117


Which one is not needed for multi-program environment?

1050


What are types of threads?

1201


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

1624


What are the benefits of multithreaded programming?

1107


Explain how to kill a particular process in windows?

1001


Explain how scheduling and priority works in threads?

1123


What is the default kill signal?

1070