Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


Hi can anyone explain about the synchronization objects
types and where we are using in the code.



Hi can anyone explain about the synchronization objects types and where we are using in the code...

Answer / nishant

CRITICAL_SECTION :- CRITICAL_SECTION (CS) objects are initialized and deleted but do not have handles and are not shared by other processes. A variable should be declared to be of type CRITICAL_SECTION. Threads enter and leave a CS, and only one thread at a time can be in a specific CS. EnterCriticalSection blocks a thread if another thread is in the section. The waiting thread unblocks when another thread executes LeaveCriticalSection. If a thread already owns the CS, it can enter again without blocking; that is, CRITICAL_SECTIONs are recursive. CRITICAL_SECTIONs have the advantage of not being kernel objects and are maintained in user space. This usually, but not always, provides performance improvements.

Mutex: - mutexes can be named and have handles, they can also be used for interprocess synchronization between threads in separate processes. Mutex objects are similar to CSs, but, in addition to being process-sharable, mutexes allow time-out values and become signaled when abandoned by a terminating process.A thread gains mutex ownership (or locks the mutex) by waiting on the mutex handle (WaitForSingleObject or WaitForMultipleObjects), and it releases ownership with ReleaseMutex.

Semaphore :- Semaphores maintain a count, and the semaphore object is signaled when the count is greater than 0. The semaphore object is unsignaled when the count is 0.

Event :- Events are used to signal other threads that some event, such as a message being available, has occurred.

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More MFC Interview Questions

Hi All, i am new for VC++ SDK. i want to get the IP Address of all the External device connected with my local machine.please give the code Regards, Praveer

1 Answers   TCS, Tech Mahindra,


In VC++ How to transfer between one exe to another exe while running..

5 Answers   Wipro,


What is a message map?

1 Answers   Mphasis,


1)To Remove WS_MINIMIZEBOX in a Frame ?

1 Answers  


if i modified data in 1 view how does the other view knows

2 Answers   Siemens,






What types of threads are supported by MFC framework?

2 Answers  


What is serialization ?which function is responsible for serializing data ?

5 Answers  


What is primitive and non-primitive application?

2 Answers   HCL,


What is Multithreading

1 Answers   Invensys,


I have 2 threads. One thread prints odd numbers and the second thread prints even numbers. Now, I have to execute the threads alternatively so that i can output 1,2,3,4,5,6,..... write code for this?

1 Answers  


How we can findout Memoryleaks, In what way it can be avoided

6 Answers   Infosys,


1)How to create ToolTip in MFC?

2 Answers  






Categories