OLD | NEW |
(Empty) | |
| 1 Indirect Service Demo |
| 2 ===================== |
| 3 |
| 4 This demo is intended to highlight the difference between requesting a service |
| 5 and providing one. The demo is based on two services: IntegerService and |
| 6 IndirectIntegerService. |
| 7 |
| 8 interface IntegerService { |
| 9 Increment() => (int32 value); |
| 10 }; |
| 11 |
| 12 This trival interface just manages a single internal integer that's initialized |
| 13 to 0. The Increment() method returns a new value. |
| 14 |
| 15 interface IndirectIntegerService { |
| 16 Set(IntegerService? service); |
| 17 Get(IntegerService&? service); |
| 18 }; |
| 19 |
| 20 This service delegates to the one IntegerService provided by the Set() method. |
| 21 Clients use Get() to request a connection to an IntegerService that targets the |
| 22 delegate. This is roughly an IntegerService "pointer". |
| 23 |
| 24 The demo creates a set of threads all of which get their own connection to the |
| 25 shared IntegerService via the IndirectIntegerService. The threads all access |
| 26 the IntegerService at the same time and then display a little table of the |
| 27 results. |
OLD | NEW |