瀏覽代碼

readme updated

Unknown 6 年之前
父節點
當前提交
81920aaa92
共有 1 個文件被更改,包括 23 次插入4 次删除
  1. 23 4
      README.md

+ 23 - 4
README.md

@@ -251,7 +251,12 @@ SMTP.SendMail;
 - **TThreadedQueueCS:** Version of TThreadedQueue with Critical Section.
 - **TThreadedQueueCS:** Version of TThreadedQueue with Critical Section.
 - **TThreadObjectList:** Thread safe Object List.
 - **TThreadObjectList:** Thread safe Object List.
 - **TThreadedQueueList:** Thread safe Queue List. Autogrow and with Critical Section.
 - **TThreadedQueueList:** Thread safe Queue List. Autogrow and with Critical Section.
-- **TAnonymousThread:** Creates anonymous thread defining unchained Execute and OnTerminate methods.
+- **TAnonymousThread:** Creates anonymous thread defining unchained Execute and OnTerminate methods. Use Execute_Sync and OnTerminate_Sync methods if code needs to update UI.
+  - *Execute:* Specify code to execute on start.
+  - *Execute_Sync:* Like Execute but runs code with syncronized thread method (avoids problems if your code updates UI).
+  - *OnTerminate:* Specify code to execute when task finishes.
+  - *OnTerminate_Sync:* Like OnTerminate but runs code with syncronized thread method (avoids problems if your code updates UI).
+  - *Start:* Starts thread execution.
 ```delphi
 ```delphi
 //simple anonymousthread
 //simple anonymousthread
 TAnonymousThread.Execute(
 TAnonymousThread.Execute(
@@ -270,7 +275,13 @@ TAnonymousThread.Execute(
       end)
       end)
     .Start;
     .Start;
 ```
 ```
-- **TBackgroundsTasks:** Launch tasks in background allowing number of concurrent workers.
+- **TBackgroundsTasks:** Launch tasks in background allowing number of concurrent workers. Use AddTask_Sync and OnTerminate_Sync methods if code needs to update UI.
+  - *AddTask:* Specify Task name, parameters to pass to anonymous method(If OwnedParams=true, task will free params on expiration task) and method than will be executed. 
+  - *AddTask_Sync:* Like AddTask but runs code with synchronize thread method (avoids problems if your code updates UI).
+  - *OnTerminate:* Specify code to execute when task finishes.
+  - *OnTerminate_Sync:* Like OnTerminate but runs code with syncronized thread method (avoids problems if your code updates UI).
+  - *OnException:* Specify code to execute when task generates an exception.
+  - *Start:* Starts tasks execution.
 ```delphi
 ```delphi
     backgroundtasks := TBackgroundTasks.Create(10);
     backgroundtasks := TBackgroundTasks.Create(10);
     for i := 1 to 100 do
     for i := 1 to 100 do
@@ -299,12 +310,20 @@ TAnonymousThread.Execute(
     end;
     end;
     backgroundtasks.Start;
     backgroundtasks.Start;
 ```
 ```
-- **TScheduledTasks:** Alternative to Timer. You can assign tasks with start time, repeat options and expiration date.
+- **TScheduledTasks:** Alternative to Timer. You can assign tasks with start time, repeat options and expiration date. Use AddTask_Sync, OnTerminate_Sync and OnExpired_Sync if code needs to update UI.
 You can assign anonymous methods to execute, exception, terminate and expiration events.
 You can assign anonymous methods to execute, exception, terminate and expiration events.
   - *AddTask:* Specify Task name, parameters to pass to anonymous method(If OwnedParams=true, task will free params on expiration task) and method than will be executed. 
   - *AddTask:* Specify Task name, parameters to pass to anonymous method(If OwnedParams=true, task will free params on expiration task) and method than will be executed. 
+  - *AddTask_Sync:* Like AddTask but runs code with synchronize thread method (avoids problems if your code updates UI).
+  - *OnTerminate:* Specify code to execute when task finishes.
+  - *OnTerminate_Sync:* Like OnTerminate but runs code with syncronized thread method (avoids problems if your code updates UI).
+  - *OnExpire:* Specify code to execute when task expiration reached or task was cancelled.
+  - *OnExpire_Sync:* Like OnExpire but runs code with synchronized thread method (avoids problems if your code updates UI).
+  - *OnException:* Specify code to execute when task generates an exception.
   - *StartAt:* Date and time to start task.
   - *StartAt:* Date and time to start task.
   - *RunOnce:* Task will executed only one time. If there aren't a previous StartAt, task will be executed immediately.
   - *RunOnce:* Task will executed only one time. If there aren't a previous StartAt, task will be executed immediately.
-  - *RepeatEvery:* Can indicate repeat step over time and expiration date. If not previous StartAtspecified, task will be executed immediately.
+  - *RepeatEvery:* Can indicate repeat step over time and expiration date. If not previous StartAt was specified, task will be executed immediately.
+  - *Start:* Starts scheduler.
+  - *Stop:* Stops scheduler.
 ```delphi
 ```delphi
 myjob := TMyJob.Create;
 myjob := TMyJob.Create;
 myjob.Name := Format('Run at %s and repeat every 1 second until %s',[DateTimeToStr(ScheduledDate),DateTimeToStr(ExpirationDate)]);
 myjob.Name := Format('Run at %s and repeat every 1 second until %s',[DateTimeToStr(ScheduledDate),DateTimeToStr(ExpirationDate)]);