Context
In order for us to understand how the runtime is able to enforce a threading requirement based on an attribute, we have to introduce the concept of context. Step 4 of the Threading example is the same code as Step 3, but with some additional output:
Is the customer object a proxy? False Is the bookings object a proxy? True Added Boston Presidential Hotel with one room. Thread 111 ContextId 0 launching 3 threads. MakeReservation: Thread 126 ContextId 0 starting. MakeReservation: Thread 127 ContextId 0 starting. CancelReservation: Thread 128 ContextId 0 starting. Cancelling Reservation 10 Thread 128 ContextId 1 entered CancelReservation. Thread 128 ContextId 1 left CancelReservation. Reserving for Customer 2 ... on 12/13/2001 ... for 1 ...
Get Application Development Using Visual Basic® and .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.