Changeset 142 for MicroThreading/Demo
- Timestamp:
- Jan 24, 2011, 4:02:40 PM (14 years ago)
- Location:
- MicroThreading/Demo
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
MicroThreading/Demo/Demo.lpi
r141 r142 42 42 </Item3> 43 43 </RequiredPackages> 44 <Units Count=" 28">44 <Units Count="38"> 45 45 <Unit0> 46 46 <Filename Value="Demo.lpr"/> … … 50 50 <TopLine Value="1"/> 51 51 <CursorPos X="1" Y="15"/> 52 <UsageCount Value=" 39"/>52 <UsageCount Value="40"/> 53 53 </Unit0> 54 54 <Unit1> … … 58 58 <ResourceBaseClass Value="Form"/> 59 59 <UnitName Value="UMainForm"/> 60 <IsVisibleTab Value="True"/>61 60 <EditorIndex Value="0"/> 62 61 <WindowIndex Value="0"/> 63 <TopLine Value="1 76"/>64 <CursorPos X=" 42" Y="177"/>65 <UsageCount Value=" 39"/>62 <TopLine Value="147"/> 63 <CursorPos X="29" Y="148"/> 64 <UsageCount Value="40"/> 66 65 <Loaded Value="True"/> 67 66 <LoadedDesigner Value="True"/> … … 70 69 <Filename Value="../UMicroThreading.pas"/> 71 70 <UnitName Value="UMicroThreading"/> 72 <EditorIndex Value="10"/> 73 <WindowIndex Value="0"/> 74 <TopLine Value="183"/> 75 <CursorPos X="20" Y="194"/> 76 <UsageCount Value="20"/> 71 <IsVisibleTab Value="True"/> 72 <EditorIndex Value="3"/> 73 <WindowIndex Value="0"/> 74 <TopLine Value="152"/> 75 <CursorPos X="32" Y="165"/> 76 <UsageCount Value="21"/> 77 77 <Loaded Value="True"/> 78 78 </Unit2> … … 120 120 <Filename Value="../../ExceptionLogger/UStackTrace.pas"/> 121 121 <UnitName Value="UStackTrace"/> 122 <EditorIndex Value="8"/>123 122 <WindowIndex Value="0"/> 124 123 <TopLine Value="56"/> 125 124 <CursorPos X="24" Y="77"/> 126 125 <UsageCount Value="20"/> 127 <Loaded Value="True"/>128 126 <DefaultSyntaxHighlighter Value="Delphi"/> 129 127 </Unit8> … … 131 129 <Filename Value="../../ExceptionLogger/CustomLineInfo.pas"/> 132 130 <UnitName Value="CustomLineInfo"/> 133 <EditorIndex Value="9"/>134 131 <WindowIndex Value="0"/> 135 132 <TopLine Value="264"/> 136 133 <CursorPos X="37" Y="141"/> 137 134 <UsageCount Value="20"/> 138 <Loaded Value="True"/>139 135 <DefaultSyntaxHighlighter Value="Delphi"/> 140 136 </Unit9> … … 185 181 <Filename Value="../Other/Coroutine.pas"/> 186 182 <UnitName Value="Coroutine"/> 187 <EditorIndex Value="6"/>188 183 <WindowIndex Value="0"/> 189 184 <TopLine Value="290"/> 190 185 <CursorPos X="36" Y="306"/> 191 <UsageCount Value="20"/> 192 <Loaded Value="True"/> 186 <UsageCount Value="21"/> 193 187 </Unit16> 194 188 <Unit17> … … 230 224 <Filename Value="../MicroThreading.pas"/> 231 225 <UnitName Value="MicroThreading"/> 232 <EditorIndex Value="7"/>233 226 <WindowIndex Value="0"/> 234 227 <TopLine Value="1"/> 235 228 <CursorPos X="25" Y="9"/> 236 <UsageCount Value="12"/> 237 <Loaded Value="True"/> 229 <UsageCount Value="13"/> 238 230 </Unit22> 239 231 <Unit23> … … 243 235 <TopLine Value="38"/> 244 236 <CursorPos X="29" Y="50"/> 245 <UsageCount Value="1 2"/>237 <UsageCount Value="13"/> 246 238 <Loaded Value="True"/> 247 239 </Unit23> … … 252 244 <TopLine Value="161"/> 253 245 <CursorPos X="11" Y="184"/> 254 <UsageCount Value="1 2"/>246 <UsageCount Value="13"/> 255 247 <Loaded Value="True"/> 256 248 </Unit24> 257 249 <Unit25> 258 250 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/objpas/sysutils/dati.inc"/> 259 <EditorIndex Value="5"/>260 251 <WindowIndex Value="0"/> 261 252 <TopLine Value="254"/> 262 253 <CursorPos X="12" Y="258"/> 263 <UsageCount Value="12"/> 264 <Loaded Value="True"/> 254 <UsageCount Value="13"/> 265 255 </Unit25> 266 256 <Unit26> 267 257 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/win/sysutils.pp"/> 268 258 <UnitName Value="sysutils"/> 269 <EditorIndex Value="3"/>270 259 <WindowIndex Value="0"/> 271 260 <TopLine Value="581"/> 272 261 <CursorPos X="11" Y="585"/> 273 <UsageCount Value="12"/> 274 <Loaded Value="True"/> 262 <UsageCount Value="13"/> 275 263 </Unit26> 276 264 <Unit27> 277 265 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/win/wininc/redef.inc"/> 278 <EditorIndex Value="4"/>279 266 <WindowIndex Value="0"/> 280 267 <TopLine Value="525"/> 281 268 <CursorPos X="11" Y="538"/> 282 <UsageCount Value="12"/> 283 <Loaded Value="True"/> 269 <UsageCount Value="13"/> 284 270 </Unit27> 271 <Unit28> 272 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/packages/fcl-base/src/syncobjs.pp"/> 273 <UnitName Value="syncobjs"/> 274 <EditorIndex Value="10"/> 275 <WindowIndex Value="0"/> 276 <TopLine Value="57"/> 277 <CursorPos X="16" Y="70"/> 278 <UsageCount Value="10"/> 279 <Loaded Value="True"/> 280 </Unit28> 281 <Unit29> 282 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/inc/threadh.inc"/> 283 <EditorIndex Value="11"/> 284 <WindowIndex Value="0"/> 285 <TopLine Value="18"/> 286 <CursorPos X="50" Y="31"/> 287 <UsageCount Value="10"/> 288 <Loaded Value="True"/> 289 </Unit29> 290 <Unit30> 291 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/inc/thread.inc"/> 292 <EditorIndex Value="13"/> 293 <WindowIndex Value="0"/> 294 <TopLine Value="109"/> 295 <CursorPos X="3" Y="112"/> 296 <UsageCount Value="10"/> 297 <Loaded Value="True"/> 298 </Unit30> 299 <Unit31> 300 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/win/sysosh.inc"/> 301 <EditorIndex Value="12"/> 302 <WindowIndex Value="0"/> 303 <TopLine Value="12"/> 304 <CursorPos X="3" Y="25"/> 305 <UsageCount Value="10"/> 306 <Loaded Value="True"/> 307 </Unit31> 308 <Unit32> 309 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/objpas/classes/classesh.inc"/> 310 <EditorIndex Value="5"/> 311 <WindowIndex Value="0"/> 312 <TopLine Value="1507"/> 313 <CursorPos X="3" Y="1469"/> 314 <UsageCount Value="10"/> 315 <Loaded Value="True"/> 316 </Unit32> 317 <Unit33> 318 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/win/tthread.inc"/> 319 <EditorIndex Value="7"/> 320 <WindowIndex Value="0"/> 321 <TopLine Value="96"/> 322 <CursorPos X="15" Y="98"/> 323 <UsageCount Value="10"/> 324 <Loaded Value="True"/> 325 </Unit33> 326 <Unit34> 327 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/win/wininc/func.inc"/> 328 <EditorIndex Value="9"/> 329 <WindowIndex Value="0"/> 330 <TopLine Value="130"/> 331 <CursorPos X="10" Y="143"/> 332 <UsageCount Value="10"/> 333 <Loaded Value="True"/> 334 </Unit34> 335 <Unit35> 336 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/win/wininc/defines.inc"/> 337 <EditorIndex Value="8"/> 338 <WindowIndex Value="0"/> 339 <TopLine Value="1923"/> 340 <CursorPos X="6" Y="1936"/> 341 <UsageCount Value="10"/> 342 <Loaded Value="True"/> 343 </Unit35> 344 <Unit36> 345 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/objpas/classes/classes.inc"/> 346 <EditorIndex Value="6"/> 347 <WindowIndex Value="0"/> 348 <TopLine Value="109"/> 349 <CursorPos X="6" Y="115"/> 350 <UsageCount Value="10"/> 351 <Loaded Value="True"/> 352 </Unit36> 353 <Unit37> 354 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/inc/objpash.inc"/> 355 <EditorIndex Value="4"/> 356 <WindowIndex Value="0"/> 357 <TopLine Value="181"/> 358 <CursorPos X="21" Y="194"/> 359 <UsageCount Value="10"/> 360 <Loaded Value="True"/> 361 </Unit37> 285 362 </Units> 286 363 <JumpHistory Count="30" HistoryIndex="29"> 287 364 <Position1> 288 <Filename Value=" UMainForm.pas"/>289 <Caret Line=" 41" Column="24" TopLine="28"/>365 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/inc/threadh.inc"/> 366 <Caret Line="63" Column="35" TopLine="49"/> 290 367 </Position1> 291 368 <Position2> 292 <Filename Value=" UMainForm.pas"/>293 <Caret Line=" 182" Column="45" TopLine="169"/>369 <Filename Value="../../../../Programy/Lazarus/0.9.31_2.4.3/fpc/2.4.3/source/rtl/inc/threadh.inc"/> 370 <Caret Line="31" Column="50" TopLine="18"/> 294 371 </Position2> 295 372 <Position3> 296 373 <Filename Value="../UMicroThreading.pas"/> 297 <Caret Line=" 8" Column="57" TopLine="1"/>374 <Caret Line="24" Column="7" TopLine="23"/> 298 375 </Position3> 299 376 <Position4> 300 377 <Filename Value="../UMicroThreading.pas"/> 301 <Caret Line=" 71" Column="20" TopLine="49"/>378 <Caret Line="152" Column="4" TopLine="180"/> 302 379 </Position4> 303 380 <Position5> 304 381 <Filename Value="../UMicroThreading.pas"/> 305 <Caret Line=" 97" Column="24" TopLine="75"/>382 <Caret Line="189" Column="1" TopLine="180"/> 306 383 </Position5> 307 384 <Position6> 308 385 <Filename Value="../UMicroThreading.pas"/> 309 <Caret Line="1 19" Column="38" TopLine="97"/>386 <Caret Line="190" Column="1" TopLine="180"/> 310 387 </Position6> 311 388 <Position7> 312 389 <Filename Value="../UMicroThreading.pas"/> 313 <Caret Line="1 26" Column="61" TopLine="104"/>390 <Caret Line="185" Column="1" TopLine="180"/> 314 391 </Position7> 315 392 <Position8> 316 393 <Filename Value="../UMicroThreading.pas"/> 317 <Caret Line="18 2" Column="34" TopLine="147"/>394 <Caret Line="186" Column="1" TopLine="180"/> 318 395 </Position8> 319 396 <Position9> 320 397 <Filename Value="../UMicroThreading.pas"/> 321 <Caret Line=" 277" Column="45" TopLine="258"/>398 <Caret Line="191" Column="1" TopLine="180"/> 322 399 </Position9> 323 400 <Position10> 324 401 <Filename Value="../UMicroThreading.pas"/> 325 <Caret Line="1 36" Column="14" TopLine="120"/>402 <Caret Line="149" Column="1" TopLine="136"/> 326 403 </Position10> 327 404 <Position11> 328 <Filename Value=" UMainForm.pas"/>329 <Caret Line="1 91" Column="91" TopLine="173"/>405 <Filename Value="../UMicroThreading.pas"/> 406 <Caret Line="189" Column="1" TopLine="176"/> 330 407 </Position11> 331 408 <Position12> 332 <Filename Value=" UMainForm.pas"/>333 <Caret Line="1 79" Column="40" TopLine="165"/>409 <Filename Value="../UMicroThreading.pas"/> 410 <Caret Line="190" Column="1" TopLine="176"/> 334 411 </Position12> 335 412 <Position13> 336 413 <Filename Value="../UMicroThreading.pas"/> 337 <Caret Line="1 93" Column="1" TopLine="181"/>414 <Caret Line="185" Column="1" TopLine="176"/> 338 415 </Position13> 339 416 <Position14> 340 417 <Filename Value="../UMicroThreading.pas"/> 341 <Caret Line="1 1" Column="56" TopLine="1"/>418 <Caret Line="186" Column="1" TopLine="176"/> 342 419 </Position14> 343 420 <Position15> 344 421 <Filename Value="../UMicroThreading.pas"/> 345 <Caret Line="1 5" Column="33" TopLine="1"/>422 <Caret Line="191" Column="1" TopLine="176"/> 346 423 </Position15> 347 424 <Position16> 348 <Filename Value=" UMainForm.pas"/>349 <Caret Line=" 202" Column="91" TopLine="183"/>425 <Filename Value="../UMicroThreading.pas"/> 426 <Caret Line="149" Column="1" TopLine="136"/> 350 427 </Position16> 351 428 <Position17> 352 429 <Filename Value="../UMicroThreading.pas"/> 353 <Caret Line=" 42" Column="22" TopLine="22"/>430 <Caret Line="156" Column="1" TopLine="136"/> 354 431 </Position17> 355 432 <Position18> 356 433 <Filename Value="../UMicroThreading.pas"/> 357 <Caret Line=" 92" Column="1" TopLine="92"/>434 <Caret Line="157" Column="1" TopLine="136"/> 358 435 </Position18> 359 436 <Position19> 360 <Filename Value=" UMainForm.pas"/>361 <Caret Line=" 89" Column="19" TopLine="72"/>437 <Filename Value="../UMicroThreading.pas"/> 438 <Caret Line="158" Column="1" TopLine="136"/> 362 439 </Position19> 363 440 <Position20> 364 441 <Filename Value="../UMicroThreading.pas"/> 365 <Caret Line=" 75" Column="22" TopLine="62"/>442 <Caret Line="189" Column="1" TopLine="176"/> 366 443 </Position20> 367 444 <Position21> 368 <Filename Value=" UMainForm.pas"/>369 <Caret Line=" 89" Column="22" TopLine="76"/>445 <Filename Value="../UMicroThreading.pas"/> 446 <Caret Line="190" Column="1" TopLine="176"/> 370 447 </Position21> 371 448 <Position22> 372 449 <Filename Value="../UMicroThreading.pas"/> 373 <Caret Line=" 175" Column="9" TopLine="175"/>450 <Caret Line="409" Column="21" TopLine="387"/> 374 451 </Position22> 375 452 <Position23> 376 453 <Filename Value="../UMicroThreading.pas"/> 377 <Caret Line=" 79" Column="20" TopLine="64"/>454 <Caret Line="206" Column="18" TopLine="201"/> 378 455 </Position23> 379 456 <Position24> 380 457 <Filename Value="../UMicroThreading.pas"/> 381 <Caret Line=" 172" Column="23" TopLine="170"/>458 <Caret Line="21" Column="15" TopLine="7"/> 382 459 </Position24> 383 460 <Position25> 384 461 <Filename Value="../UMicroThreading.pas"/> 385 <Caret Line=" 349" Column="1" TopLine="1"/>462 <Caret Line="123" Column="50" TopLine="110"/> 386 463 </Position25> 387 464 <Position26> 388 465 <Filename Value="../UMicroThreading.pas"/> 389 <Caret Line="1 92" Column="17" TopLine="179"/>466 <Caret Line="165" Column="29" TopLine="145"/> 390 467 </Position26> 391 468 <Position27> 392 469 <Filename Value="../UMicroThreading.pas"/> 393 <Caret Line="1 1" Column="66" TopLine="1"/>470 <Caret Line="148" Column="31" TopLine="135"/> 394 471 </Position27> 395 472 <Position28> 396 <Filename Value=" UMainForm.pas"/>397 <Caret Line=" 43" Column="1" TopLine="30"/>473 <Filename Value="../UMicroThreading.pas"/> 474 <Caret Line="165" Column="26" TopLine="152"/> 398 475 </Position28> 399 476 <Position29> 400 <Filename Value=" UMainForm.pas"/>401 <Caret Line=" 83" Column="1" TopLine="70"/>477 <Filename Value="../UMicroThreading.pas"/> 478 <Caret Line="148" Column="31" TopLine="148"/> 402 479 </Position29> 403 480 <Position30> 404 <Filename Value=" UMainForm.pas"/>405 <Caret Line="15 4" Column="16" TopLine="141"/>481 <Filename Value="../UMicroThreading.pas"/> 482 <Caret Line="150" Column="31" TopLine="135"/> 406 483 </Position30> 407 484 </JumpHistory> … … 439 516 <Item3> 440 517 <Source Value="umainform.pas"/> 441 <Line Value="5 5"/>518 <Line Value="58"/> 442 519 </Item3> 443 520 <Item4> -
MicroThreading/Demo/UMainForm.lfm
r140 r142 15 15 Height = 25 16 16 Top = 13 17 Width = 1 1917 Width = 103 18 18 Caption = 'Start scheduler' 19 19 OnClick = Button1Click … … 64 64 object Memo1: TMemo 65 65 Left = 10 66 Height = 41967 Top = 8866 Height = 379 67 Top = 128 68 68 Width = 294 69 69 Anchors = [akTop, akLeft, akBottom] … … 72 72 end 73 73 object Button2: TButton 74 Left = 17674 Left = 224 75 75 Height = 25 76 Top = 1376 Top = 96 77 77 Width = 75 78 78 Caption = 'Button2' … … 83 83 Left = 10 84 84 Height = 25 85 Top = 5785 Top = 96 86 86 Width = 75 87 87 Caption = 'Coroutine' … … 92 92 Left = 10 93 93 Height = 14 94 Top = 4094 Top = 80 95 95 Width = 32 96 96 Caption = 'Label2' 97 97 ParentColor = False 98 end 99 object Button4: TButton 100 Left = 136 101 Height = 25 102 Top = 12 103 Width = 75 104 Caption = 'Start workers' 105 OnClick = Button4Click 106 TabOrder = 5 107 end 108 object SpinEdit1: TSpinEdit 109 Left = 217 110 Height = 21 111 Top = 13 112 Width = 82 113 MaxValue = 100000 114 MinValue = 1 115 TabOrder = 6 116 Value = 20 98 117 end 99 118 object Timer1: TTimer -
MicroThreading/Demo/UMainForm.pas
r141 r142 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ComCtrls, ExtCtrls, UMicroThreading, Coroutine, DateUtils;9 ComCtrls, ExtCtrls, Spin, UMicroThreading, Coroutine, DateUtils; 10 10 11 11 type … … 23 23 Button2: TButton; 24 24 Button3: TButton; 25 Button4: TButton; 25 26 Label1: TLabel; 26 27 Label2: TLabel; 27 28 ListView1: TListView; 28 29 Memo1: TMemo; 30 SpinEdit1: TSpinEdit; 29 31 Timer1: TTimer; 30 32 procedure Button1Click(Sender: TObject); 31 33 procedure Button2Click(Sender: TObject); 32 34 procedure Button3Click(Sender: TObject); 35 procedure Button4Click(Sender: TObject); 33 36 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 34 37 procedure FormCreate(Sender: TObject); … … 70 73 begin 71 74 Scheduler := TMicroThreadScheduler.Create; 72 Scheduler.FreeMicroThreadOnFinish := False;73 75 Test := TTest.Create; 74 76 DoubleBuffered := True; … … 84 86 Scheduler.MicroThreads.Clear; 85 87 Memo1.Clear; 86 for I := 0 to 20 do87 Scheduler.Add('Worker', Worker);88 88 Scheduler.Start; 89 89 end else begin … … 149 149 begin 150 150 Test.Invoke; 151 end; 152 153 procedure TForm1.Button4Click(Sender: TObject); 154 var 155 I: Integer; 156 begin 157 for I := 0 to SpinEdit1.Value do 158 Scheduler.AddMethod(Worker); 151 159 end; 152 160
Note:
See TracChangeset
for help on using the changeset viewer.