Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
When working with shared data in threading how do you implement synchronization ?
.NET INTERVIEW QUESTIONS - When working with shared data in threading how do you implement synchronization ?
✍: Guest
There are certain situtations that you need to be careful with when using threads. If two threads (e.g. the main and any worker threads) try to access the same variable at the same time, you'll have a problem. This can be very difficult to debug because they may not always do it at exactly the same time.
To avoid the problem, you can lock a variable before accessing it. However, if the two threads lock the same variable at the same time, you'll have a deadlock problem.
SyncLock x
'Do something with x
End SyncLock
2009-12-15, 4387👍, 0💬
Popular Posts:
What is the sequence of UML diagrams in project? First let me say some fact about this question, you...
What will the following piece of code do? int f(unsigned int x) { int i; for (i=0; x!=0; x>&a...
How To Delete All Rows a Table? - MySQL FAQs - Understanding SQL INSERT, UPDATE and DELETE Statement...
What is hashing? To hash means to grind up, and that's essentially what hashing is all about. The he...
How To Run "mysql" Commands from a Batch File? - MySQL FAQs - Command-Line End User Interface mysql ...