O'Reilly logo

Microsoft® Visual J#™ .NET (Core Reference) by John/Longshaw, Andy Sharp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Synchronization

Earlier, when we discussed a technique for passing parameters to threads using a property, you learned that problems can occur, mainly due to uncertainty about how threads are executed. You can never guarantee the order in which threads are run (unless they all have different priorities), so if one thread sets some shared data to a value that is read by another, the reading thread might run before the writing thread has actually written the data. In situations in which the running order matters, threads must be carefully synchronized.

As a simple example, consider the Stock and StockController classes shown in the StockControl.jsl file in the StockControl project. The Stock class models stock items held in a fictitious warehouse. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required