1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List href="./pool_bestanden/filelist.xml">
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:LastAuthor>Erik</o:LastAuthor>
<o:Revision>97</o:Revision>
<o:TotalTime>516</o:TotalTime>
<o:LastPrinted>2002-05-15T11:24:00Z</o:LastPrinted>
<o:Created>2002-04-16T19:32:00Z</o:Created>
<o:LastSaved>2002-05-15T11:27:00Z</o:LastSaved>
<o:Pages>6</o:Pages>
<o:Words>1767</o:Words>
<o:Characters>10077</o:Characters>
<o:Company>None</o:Company>
<o:Lines>83</o:Lines>
<o:Paragraphs>20</o:Paragraphs>
<o:CharactersWithSpaces>12375</o:CharactersWithSpaces>
<o:Version>9.2812</o:Version>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:HyphenationZone>21</w:HyphenationZone>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:553679495 -2147483648 8 0 66047 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
p.MsoDocumentMap, li.MsoDocumentMap, div.MsoDocumentMap
{margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
background:navy;
font-size:12.0pt;
font-family:Tahoma;
mso-fareast-font-family:"Times New Roman";}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Courier New";
mso-fareast-font-family:"Times New Roman";}
@page Section1
{size:8.5in 11.0in;
margin:.8in .8in .7in .7in;
mso-header-margin:.2in;
mso-footer-margin:.2in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
/* List Definitions */
@list l0
{mso-list-id:491943773;
mso-list-type:hybrid;
mso-list-template-ids:389161538 700215070 68354051 68354053 68354049 68354051 68354053 68354049 68354051 68354053;}
@list l0:level1
{mso-level-start-at:2;
mso-level-number-format:bullet;
mso-level-text:-;
mso-level-tab-stop:53.4pt;
mso-level-number-position:left;
margin-left:53.4pt;
text-indent:-.25in;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
@list l1
{mso-list-id:2044330862;
mso-list-type:hybrid;
mso-list-template-ids:1794557052 1241923622 68354073 68354075 68354063 68354073 68354075 68354063 68354073 68354075;}
@list l1:level1
{mso-level-tab-stop:106.15pt;
mso-level-number-position:left;
margin-left:106.15pt;
text-indent:-35.35pt;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
-->
</style>
<meta name=CVS content="$Id: pool.html,v 1.2 2004/01/15 06:36:14 andreas_kupries Exp $">
<meta name=CVS content="$Id: pool.html,v 1.2 2004/01/15 06:36:14 andreas_kupries Exp $">
<meta name=CVS content="\$Id: pool.html,v 1.2 2004/01/15 06:36:14 andreas_kupries Exp $">
</head>
<body lang=NL style='tab-interval:35.4pt'>
<div class=Section1>
<p class=MsoPlainText><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText align=center style='text-align:center;mso-outline-level:
1'><b><span style='font-size:16.0pt;font-family:"Times New Roman"'>POOL 0.1<o:p></o:p></span></b></p>
<p class=MsoPlainText align=center style='text-align:center'><span
style='font-size:11.0pt;font-family:"Times New Roman"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText align=center style='text-align:center;mso-outline-level:
1'><span style='font-size:11.0pt;font-family:"Times New Roman"'>Author: Erik
Leunissen<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-size:11.0pt;font-family:"Times New Roman"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-size:11.0pt;font-family:"Times New Roman"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='mso-outline-level:1'><b><span lang=EN-GB
style='font-size:12.0pt;mso-bidi-font-size:14.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>NAME<o:p></o:p></span></b></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>pool
- Managing a pool of discrete items.<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='mso-outline-level:1'><b><span lang=EN-GB
style='font-size:12.0pt;mso-bidi-font-size:14.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>SYNOPSIS<o:p></o:p></span></b></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'><span style='mso-tab-count:1'></span><b>pool
</b><i>?poolName? ?maxsize?</i><o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='mso-outline-level:1'><b><span lang=EN-GB
style='font-size:12.0pt;mso-bidi-font-size:14.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>DESCRIPTION</span></b><span lang=EN-GB
style='font-size:12.0pt;mso-bidi-font-size:11.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>The
<i>pool</i> command creates a new instance of a pool data structure. The command
takes the name of the new pool as its first argument. If no name is supplied,
then the new pool will be named pool<X>, where X is a positive integer.
The optional second argument <i>maxsize</i> is a positive integer indicating
the maximum size of the pool; this is the maximum number of items the pool may
hold.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='mso-outline-level:1'><b><span lang=EN-GB
style='font-size:12.0pt;mso-bidi-font-size:14.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>POOLS AND ALLOCATION<o:p></o:p></span></b></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:12.0pt;mso-bidi-font-size:
11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>The
purpose of the <i>pool</i> command and the pool object command that it
generates, is to manage pools of discrete items.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>Examples
of a pool of discrete items are:<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:53.4pt;text-indent:-.25in;mso-list:
l0 level1 lfo2;tab-stops:list 53.4pt'><![if !supportLists]><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>-<span
style='font:7.0pt "Times New Roman"'>
</span></span><![endif]><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'>the seats in a cinema, theatre,
train etc.. for which visitors/travellers can<span style="mso-spacerun: yes">
</span>make a reservation;<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:53.4pt;text-indent:-.25in;mso-list:
l0 level1 lfo2;tab-stops:list 53.4pt'><![if !supportLists]><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>-<span
style='font:7.0pt "Times New Roman"'>
</span></span><![endif]><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'>the dynamic IP-addresses that an ISP
can dole out<span style="mso-spacerun: yes"></span>to subscribers;<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:53.4pt;text-indent:-.25in;mso-list:
l0 level1 lfo2;tab-stops:list 53.4pt'><![if !supportLists]><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>-<span
style='font:7.0pt "Times New Roman"'>
</span></span><![endif]><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'>a car rental's collection of cars,
which can be rented by customers;<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:53.4pt;text-indent:-.25in;mso-list:
l0 level1 lfo2;tab-stops:list 53.4pt'><![if !supportLists]><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>-<span
style='font:7.0pt "Times New Roman"'>
</span></span><![endif]><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'>the class rooms in a school
building, which need to be scheduled;<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:53.4pt;text-indent:-.25in;mso-list:
l0 level1 lfo2;tab-stops:list 53.4pt'><![if !supportLists]><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>-<span
style='font:7.0pt "Times New Roman"'>
</span></span><![endif]><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'>the database connections available
to client-threads in a web-server application;<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:53.4pt;text-indent:-.25in;mso-list:
l0 level1 lfo2;tab-stops:list 53.4pt'><![if !supportLists]><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>-<span
style='font:7.0pt "Times New Roman"'>
</span></span><![endif]><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'>the books in a library that
customers can borrow;<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:53.4pt;text-indent:-.25in'><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'>etc ...<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>The
common denominator in the examples is that there is a more or less fixed number
of items (seats, IP-addresses, cars, ...) that are supposed to be allocated on
a more or less regular basis. An item can be allocated only once at a time. An
item that is allocated, must be released before it can be re-allocated. While
several items in a pool are being allocated and released continuously, the
total number of items in the pool remains constant.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>Keeping
track of which items are allocated, and by whom, is the purpose of the <i>pool</i>
command and its subordinates.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;mso-outline-level:1'><b><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'>Pool parlance<o:p></o:p></span></b></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>If
we say that an item is allocated, it means that the item is <i>busy</i>, <i>owned</i>
or <i>occupied</i>; it is not available anymore. If an item is free, it is
available. <i>Deallocating</i> an item is equivalent to <i>setting free</i> or <i>releasing</i>
an item. The person or entity to which the item has been allotted is said to <i>own</i>
the item.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText><b><span lang=EN-GB style='font-size:12.0pt;mso-bidi-font-size:
11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>ITEMS<o:p></o:p></span></b></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;mso-outline-level:1'><b><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'>Discrete items<o:p></o:p></span></b></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>The
<i>pool</i> command is designed for <b>discrete items only</b>. Note that there
are pools where allocation occurs on a non-discrete basis, for example computer
memory. There are also pools from which the shares that are doled out are not
expected to be returned, for example a charity fund or a pan of soup from which
you may receive a portion. Finally, there are even pools from which nothing is
ever allocated or returned, like a swimming pool or a cesspool.<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;mso-outline-level:1'><b><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'>Unique item names<o:p></o:p></span></b></p>
<p class=MsoPlainText style='margin-left:35.4pt;mso-outline-level:1'><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'>A pool cannot manage duplicate item names. Therefore, items in a pool
must have unique names.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><b><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><span
style="mso-spacerun: yes"></span><o:p></o:p></span></b></p>
<p class=MsoPlainText style='margin-left:35.4pt;mso-outline-level:1'><b><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'>Item equivalence<o:p></o:p></span></b></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>From
the point of view of the manager of a pool, items are equivalent. The manager
of a pool is indifferent about which entity/person occupies a given item.
However, clients may have preferences for a particular item, based on some item
property they know.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;mso-outline-level:1'><b><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'>Preferences<o:p></o:p></span></b></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>A
future owner may have a preference for a particular item. Preference based
allocation is supported (see the <b>-prefer</b> option to the <i>request</i>
subcommand). A preference for a particular item is most likely to result from
variability among features associated with the items. Note that the pool
commands themselves are not designed to manage such item properties. If item
properties play a role in an application, they should be<span
style="mso-spacerun: yes"></span>managed separately. <o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='mso-outline-level:1'><b><span lang=EN-GB
style='font-size:12.0pt;mso-bidi-font-size:14.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>POOL OBJECT COMMAND<o:p></o:p></span></b></p>
<p class=MsoPlainText><b><span lang=EN-GB style='font-size:12.0pt;mso-bidi-font-size:
14.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></b></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>The
<i>pool</i> command creates a new Tcl command whose name is <i>poolName</i> .
This pool object command is used to manipulate or query the pool object. The
general syntax of a pool object command is:<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><span
style='mso-tab-count:1'></span><i>poolName</i> <b>subcommand</b> <i>?arg
arg ...?</i><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>The
following subcommands and corresponding arguments are available:<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><i><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>poolName</span></i><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'> <b>add</b> <i>itemName1 ?itemName2 itemName3 ...?</i><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>This
command adds the items on the command line to the pool. If duplicate item names
occur on the command line, an error is raised. If one or more of the items
already exist in the pool, this also is considered an error.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><span
style='mso-tab-count:1'></span><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><i><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>poolName</span></i><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'> <b>clear</b> <i>?-force?</i><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>Removes
all items from the pool. If there are any allocated items at the time when the
command is invoked, an error is raised. This behaviour may be modified through
the <i>-force</i> argument. If it is supplied on the command line, the pool
will be cleared regardless the allocation state of its items.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><i><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>poolName</span></i><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'> <b>destroy</b> <i>?-force?<o:p></o:p></i></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>Destroys
the pool data structure, all associated variables and the associated pool
object command. By default, the command checks whether any items are still
allocated and raises an error if such is the case. This behaviour may be
modified through the argument -<i>force</i>. If it is supplied on the command
line, the pool data structure will be destroyed regardless allocation state of
its items. <o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";mso-fareast-font-family:
"Times New Roman";mso-ansi-language:EN-GB;mso-fareast-language:NL;mso-bidi-language:
AR-SA'><br clear=all style='page-break-before:always'>
</span>
<p class=MsoPlainText style='margin-left:35.4pt'><i><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>poolName</span></i><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'> <b>info</b> <i>type ?arg?<o:p></o:p></i></span></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:.5in;margin-bottom:
0in;margin-left:71.4pt;margin-bottom:.0001pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>Returns
various information about the pool for further programmatic use. The type
argument indicates the type of information requested. Only the <i>allocID</i>
type uses an additional argument.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:.5in;margin-bottom:
0in;margin-left:71.4pt;margin-bottom:.0001pt'><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.0in;margin-bottom:
0in;margin-left:71.4pt;margin-bottom:.0001pt'><b><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>allocID </span></b><i><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>itemName<o:p></o:p></span></i></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.0in;margin-bottom:
0in;margin-left:105.6pt;margin-bottom:.0001pt'><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>returns the allocID of the item whose name is <i>itemName.</i>
Free items have an allocation ID -1.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.0in;margin-bottom:
0in;margin-left:105.6pt;margin-bottom:.0001pt'><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.0in;margin-bottom:
0in;margin-left:71.4pt;margin-bottom:.0001pt'><b><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>allitems<o:p></o:p></span></b></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.0in;margin-bottom:
0in;margin-left:71.4pt;margin-bottom:.0001pt'><b><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'><span style='mso-tab-count:1'></span></span></b><span
lang=EN-GB style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>returns a list of all items in the pool.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.0in;margin-bottom:
0in;margin-left:71.4pt;margin-bottom:.0001pt'><b><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></b></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.0in;margin-bottom:
0in;margin-left:71.4pt;margin-bottom:.0001pt'><b><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>allocstate<o:p></o:p></span></b></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.0in;margin-bottom:
0in;margin-left:105.6pt;margin-bottom:.0001pt'><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>Returns a list of key-value pairs, where the keys are
the items and the values are the corresponding allocation ID's. Free
items have an allocation ID -1.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.0in;margin-bottom:
0in;margin-left:105.6pt;margin-bottom:.0001pt'><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.0in;margin-bottom:
0in;margin-left:71.4pt;margin-bottom:.0001pt'><b><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>cursize<o:p></o:p></span></b></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.0in;margin-bottom:
0in;margin-left:105.6pt;margin-bottom:.0001pt'><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>returns the current pool size, i.e. the
number of items in the pool.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.0in;margin-bottom:
0in;margin-left:105.6pt;margin-bottom:.0001pt'><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.0in;margin-bottom:
0in;margin-left:71.4pt;margin-bottom:.0001pt'><b><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>freeitems</span></b><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.5in;margin-bottom:
0in;margin-left:107.4pt;margin-bottom:.0001pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>returns
a list of items that currently are not allocated.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.0in;margin-bottom:
0in;margin-left:105.6pt;margin-bottom:.0001pt'><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.0in;margin-bottom:
0in;margin-left:71.4pt;margin-bottom:.0001pt'><b><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>maxsize<o:p></o:p></span></b></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.0in;margin-bottom:
0in;margin-left:105.6pt;margin-bottom:.0001pt'><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>returns the maximum size of the pool.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:1.0in;margin-bottom:
0in;margin-left:105.6pt;margin-bottom:.0001pt'><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><i><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>poolName</span></i><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'> <b>maxsize</b> <i>?maxsize?<o:p></o:p></i></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>Sets or queries the maximum size of the pool,
depending on whether the <i>maxsize</i> argument is supplied. If the optional
argument <i>maxsize</i> is supplied, the maximum size of the pool will<span
style="mso-spacerun: yes"></span>be set to that value. If no argument <i>maxsize</i>
is supplied, the current maximum size of the pool is returned. In this variant,
the command is an alias for: </span><span lang=EN-GB style='font-size:10.5pt;
mso-bidi-font-size:10.0pt;mso-ansi-language:EN-GB'>poolName info maxsize</span><span
lang=EN-GB style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>The <i>maxsize</i> argument needs to be a positive
integer.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'><span style="mso-spacerun: yes"></span><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><i><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>poolName</span></i><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'> <b>release</b> <i>itemName<o:p></o:p></i></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>Releases the item whose name is <i>itemName</i> that
was allocated previously. An error is raised if the item was not allocated at
the time when the command was issued.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'><span style="mso-spacerun: yes"></span><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><i><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>poolName</span></i><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'> <b>remove</b> <i>itemName ?-force?</i><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>Removes
the item whose name is <i>itemName</i><span style="mso-spacerun: yes">
</span>from the pool. If the item was allocated at the time when the command
was invoked, an error is raised. This behaviour may be modified through the
optional argument <i>-force</i>. If it is supplied on the command line, the
item will be removed regardless its allocation state.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";mso-fareast-font-family:
"Times New Roman";mso-ansi-language:EN-GB;mso-fareast-language:NL;mso-bidi-language:
AR-SA'><br clear=all style='page-break-before:always'>
</span>
<p class=MsoPlainText style='margin-left:35.4pt'><i><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>poolName</span></i><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'> <b>request</b> <i>itemVar ?options?</i><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>Handles
a request for an item, taking into account a possible preference for a
particular item.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>There
are two possible outcomes depending on the availability of items:<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:1.25in;text-indent:-19.2pt;mso-list:
l1 level1 lfo4'><![if !supportLists]><span lang=EN-GB style='font-size:11.0pt;
font-family:"Times New Roman";mso-ansi-language:EN-GB'>1.<span
style='font:7.0pt "Times New Roman"'> </span></span><![endif]><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'>The request is honoured, an item is allocated and the variable whose
name is passed with the argument <i>itemVar</i> will be set to the name of the
item that was allocated. The command returns 1.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:1.25in;text-indent:-19.2pt;mso-list:
l1 level1 lfo4'><![if !supportLists]><span lang=EN-GB style='font-size:11.0pt;
font-family:"Times New Roman";mso-ansi-language:EN-GB'>2.<span
style='font:7.0pt "Times New Roman"'> </span></span><![endif]><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'>The request is denied. No item is allocated. The variable whose name is <i>itemVar</i>
is not set. Attempts to read <i>itemVar</i><span style="mso-spacerun: yes">
</span>may raise an error if the variable was not defined before issuing the
request. The command returns 0.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>The
return values from this command are meant to be inspected. The examples below
show how to do this. Failure to check the return value may result in erroneous
behaviour.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>If
no preference for a particular item is supplied through the option <b>-prefer</b>
(see below), then all requests are honoured as long as items are available.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>The
following options are supported:<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><b><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>-allocID</span></b><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'> <i>allocID</i><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:106.2pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>If
the request is honoured, an item will be allocated to the entity identified by <i>allocID</i>.
If the allocation state of an item is queried, it is this allocation ID that
will be returned. If the option <b>-allocID</b> is not supplied, the item will
be allocated to<span style="mso-spacerun: yes"></span><i>dummyID</i>.
Allocation ID's may be anything except the value -1, which is reserved for free
items.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:70.8pt'><b><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>-prefer
</span></b><i><span lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>preferredItem</span></i><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:106.2pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>This
option modifies the allocation strategy as follows:<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:106.2pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>If
the item whose name is <i>preferredItem</i> is not allocated at the time when
the command is invoked, the request is honoured (return value is 1). If the item
was allocated at the time when the command was invoked, the request is denied
(return value is 0).<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:106.2pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:106.2pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='mso-outline-level:1'><b><span lang=EN-GB
style='font-size:12.0pt;mso-bidi-font-size:14.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-GB'>EXAMPLES<o:p></o:p></span></b></p>
<p class=MsoPlainText><b><span lang=EN-GB style='font-size:12.0pt;mso-bidi-font-size:
14.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></b></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>Two
examples are provided. The first one mimics a step by step interactive tclsh session,
where each step is explained. The second example shows the usage in a server
application that talks to a back-end application.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;mso-outline-level:1'><b><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'>Example 1<o:p></o:p></span></b></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>This
example presents an interactive tclsh session which considers the case of a Car
rental's collection of cars. Ten steps explain its usage in chronological
order, from the creation of the pool, via the most important stages in the
usage of a pool, to the final destruction.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:63.0pt;margin-bottom:
0in;margin-left:81.0pt;margin-bottom:.0001pt'><span lang=EN-GB
style='mso-bidi-font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'>Note aside:<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-top:0in;margin-right:63.0pt;margin-bottom:
0in;margin-left:81.0pt;margin-bottom:.0001pt'><span lang=EN-GB
style='mso-bidi-font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'>In this example, brand names are used to label the various items.
However, a brand name could be regarded as a property of an item. Because the <i>pool</i>
command is not designed to manage properties of items, they need to be managed
separately. In the latter case the items should be labelled with more neutral
names such as: car1, car2, car3 , etc ... and a separate database or array
should hold the brand names associated with the car labels.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>1.
Load the package into an interpreter<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>%
package require pool<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;color:blue;mso-ansi-language:
EN-GB'>0.1<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>2.
Create a pool object called `CarPool' with a maximum size of 55 items (cars):<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>%
pool CarPool 55<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;color:blue;mso-ansi-language:
EN-GB'>CarPool<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>4.
Add items to the pool:<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>%
CarPool add Toyota Trabant Chrysler1 Chrysler2 Volkswagen<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><span
style='mso-tab-count:1'></span><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>5.
Somebody crashed the Toyota? Remove it from the pool as follows:<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>%
CarPool remove Toyota<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>6.
Acquired a new car for the pool? Add it as follows:<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>%
CarPool add Nissan<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>7.
Check whether the pool was adjusted correctly:<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;mso-outline-level:1'><span
lang=EN-GB style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:
EN-GB'>% CarPool info allitems<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;color:blue;mso-ansi-language:
EN-GB'>Trabant Chrysler1 Chrysler2 Volkswagen Nissan<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>Suspend
interactive session temporarily, and show the programmatic use of the <b>request</b>
subcommand:<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>#
Mrs. Swift needs a car. She doesn't have a preference for a<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>#
particular car. We'll issue a request on her behalf as follows:<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>if {
[CarPool request car -allocID "Mrs. Swift"] }<span
style="mso-spacerun: yes"></span>{<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;text-indent:35.4pt;mso-outline-level:
1'><span lang=EN-GB style='font-size:10.5pt;mso-bidi-font-size:11.0pt;
mso-ansi-language:EN-GB'># request was honoured, process the variable `car'<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-GB style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:
EN-GB'>puts "$car has been allocated to [CarPool info allocID $car]."<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;mso-outline-level:1'><span
lang=EN-GB style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:
EN-GB'>} else {<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-GB style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:
EN-GB'># request was denied<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'><span
style='mso-tab-count:1'></span>puts "No car available."<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>}<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'>(note how the <b>if</b> command uses the value returned by the request
subcommand.)<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>#
Suppose mr. Wiggly has a preference for the Trabant:<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>if {
[CarPool request car -allocID "Mr. Wiggly" -prefer Trabant] }<span
style="mso-spacerun: yes"></span>{<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;text-indent:35.4pt;mso-outline-level:
1'><span lang=EN-GB style='font-size:10.5pt;mso-bidi-font-size:11.0pt;
mso-ansi-language:EN-GB'># request was honoured, process the variable `car'<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-GB style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:
EN-GB'>puts "$car has been allocated to [CarPool info allocID $car]."<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;mso-outline-level:1'><span
lang=EN-GB style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:
EN-GB'>} else {<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-GB style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:
EN-GB'># request was denied<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'><span
style='mso-tab-count:1'></span>puts "The Trabant was not
available."<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>}<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>Resume
interactive session:<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>8.
When the car is returned then you can render it available by:<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>%
CarPool release Trabant<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>9.
When done, you delete the pool.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;mso-outline-level:1'><span
lang=EN-GB style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:
EN-GB'>% CarPool destroy<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;color:#FF6600;mso-ansi-language:
EN-GB'>Couldn't destroy `CarPool' because some items are still allocated.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>Oops,
... forgot that Mrs. Swift still occupies a car.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>10.
We force the destruction of the pool as follows: <o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>%
CarPool destroy -force<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;mso-outline-level:1'><b><span
lang=EN-GB style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-GB'>Example 2<o:p></o:p></span></b></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>This
example describes the case from which the author's need for pool management
originated. It is an example of a server application that receives requests
from client applications. The client requests are dispatched onto a back-end
application before being returned to the client application. In many cases
there are a few equivalent instances of back-end applications to which a client
request may be passed along. The file descriptors that identify the channels to
these back-end instances make up a pool of connections. A particular connection
may be allocated to just one client request at a time.<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'># Create
the pool of connections (pipes)<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>set
maxpipes 10<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>pool
Pipes $maxpipes<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>for
{set i 0} {$i < $maxpipes} {incr i} {<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:10.5pt;mso-bidi-font-size:
11.0pt;mso-ansi-language:EN-GB'><span style='mso-tab-count:1'></span><span
style="mso-spacerun: yes"></span>set fd {open "|backendApplication" w+}<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:10.5pt;mso-bidi-font-size:
11.0pt;mso-ansi-language:EN-GB'><span style='mso-tab-count:1'></span><span
style="mso-spacerun: yes"></span>Pipes add $fd<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:10.5pt;mso-bidi-font-size:
11.0pt;mso-ansi-language:EN-GB'><span style='mso-tab-count:1'></span>}<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'># A
client request comes in. The request is identified as `clientX'.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;mso-outline-level:1'><span
lang=EN-GB style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:
EN-GB'># Dispatch it onto an instance of a back-end application<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>if {
[Pipes request fd -allocID clientX] } {<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;mso-outline-level:1'><span
lang=EN-GB style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:
EN-GB'><span style="mso-spacerun: yes"></span># a connection was allocated<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'><span
style="mso-spacerun: yes"></span># communicate to the back-end application
via the variable `fd'<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'><span
style="mso-spacerun: yes"></span>puts $fd "someInstruction"<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'><span
style="mso-spacerun: yes"></span># ...... etc.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>}
else {<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt;mso-outline-level:1'><span
lang=EN-GB style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:
EN-GB'><span style="mso-spacerun: yes"></span># all connections are
currently occupied<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'><span
style="mso-spacerun: yes"></span># store the client request in a queue for
later processing,<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'><span
style="mso-spacerun: yes"></span># or return a "Server busy" message to the
client.<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:10.5pt;mso-bidi-font-size:11.0pt;mso-ansi-language:EN-GB'>}<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:35.4pt'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='mso-outline-level:1'><span lang=EN-GB
style='font-size:11.0pt;font-family:"Times New Roman";mso-ansi-language:EN-GB'>#
</span><span lang=EN-GB style='font-family:"Times New Roman";mso-ansi-language:
EN-GB'>CVS: $Id: pool.html,v 1.2 2004/01/15 06:36:14 andreas_kupries Exp $<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'># EOF pool.html<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB style='font-size:11.0pt;font-family:
"Times New Roman";mso-ansi-language:EN-GB'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
</div>
</body>
</html>
|