GSSP-NET · Question #286
You work as a Windows Application Developer for ABC Inc. The company uses Visual Studio .NET 2008 as its application development platform. You create a Windows Forms application using .NET Framework…
Sign in or unlock GSSP-NET to reveal the answer and full explanation for question #286. The question stem and answer options stay visible for context.
Question
You work as a Windows Application Developer for ABC Inc. The company uses Visual Studio .NET 2008 as its application development platform. You create a Windows Forms application using .NET Framework 3.5. You create multiple threads in the application and the threads will execute the same method. You want to synchronize access to a block of code within the method; thus, no two threads execute the block at the same time. What will you do to accomplish this? Each correct answer represents a part of the solution. Choose two.
Options
- AAdd a SynchronizationAttribute attribute to the method that the multiple threads will call.
- BCall the Interlocked.Increment method before the block of code that needs to be synchronized.
- CCall the Monitor.Enter method before the block of code that needs to be synchronized.
- DCall the Interlocked.Decrement method after the block of code that needs to be synchronized.
- EAdd a Semaphore object to the method that the multiple threads will call.
- FCall the Monitor.Exit method after the block of code that needs to be synchronized.
Unlock GSSP-NET to see the answer
You've previewed enough free GSSP-NET questions. Unlock GSSP-NET for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.