[[Property:title|CECIL - Threads]] [[Property:weight|3]] [[Property:uuid|44f2ee31-8634-6e54-f45a-8b36f780f888]] ==bank_account== After you have done the appropriate steps to compile the example, you will get a `bank_account.exe` on windows, or `bank_account` on Unix. This program launches two types of threads: * the spenders withdraw some money from a shared bank account * the savers make some deposits on it. The Eiffel Threads are launched from C. The synchronization is done from Eiffel. The shared bank account is a C structure, and is updated by the Eiffel Threads using some C externals.
In main. c:
LISTSZ size of bank account history.
DEPOSITORS numbers of savers.
WITHDRAWERS numbers of spenders.
A typical output will be: $ bank_account **** Bank account report: Thread 0x30036350 DEPOSIT 161 Thread 0x30036350 DEPOSIT 614 Thread 0x30036350 DEPOSIT 626 Thread 0x30036350 DEPOSIT 880 Thread 0x30036350 DEPOSIT 601 Thread 0x30036350 DEPOSIT 480 Thread 0x30036350 DEPOSIT 177 Thread 0x30036350 DEPOSIT 451 Thread 0x30036350 DEPOSIT 96 Thread 0x30036350 DEPOSIT 219 *** BALANCE: 5305 Do you want to continue? (y/n) y **** Bank account report: Thread 0x3003fcf0 DEPOSIT 161 Thread 0x3004f088 DEPOSIT 161 Thread 0x300567a0 WITHDRAWAL 161 Thread 0x3005e1f0 WITHDRAWAL 161 Thread 0x30036350 DEPOSIT 531 Thread 0x3003fcf0 DEPOSIT 614 Thread 0x3004f088 DEPOSIT 614 Thread 0x300567a0 WITHDRAWAL 614 Thread 0x30036350 DEPOSIT 409 Thread 0x3003fcf0 DEPOSIT 626 *** BALANCE: 7485 Do you want to continue? (y/n) y **** Bank account report: Thread 0x3004f088 DEPOSIT 626 Thread 0x30036350 DEPOSIT 799 Thread 0x300567a0 WITHDRAWAL 626 Thread 0x3005e1f0 WITHDRAWAL 614 Thread 0x3003fcf0 DEPOSIT 880 Thread 0x30036350 DEPOSIT 860 Thread 0x3004f088 DEPOSIT 880 Thread 0x300567a0 WITHDRAWAL 880 Thread 0x30036350 DEPOSIT 307 Thread 0x3004f088 DEPOSIT 601 *** BALANCE: 10318