Menu

Diff of /trunk/Src/UThreadGroup.pas [r2878] .. [r2879]  Maximize  Restore

Switch to side-by-side view

--- a/trunk/Src/UThreadGroup.pas
+++ b/trunk/Src/UThreadGroup.pas
@@ -68,6 +68,9 @@
     ///  <summary>Starts all threads.</summary>
     ///  <remarks>Threads are started in the order they were added.</remarks>
     procedure Start;
+    ///  <summary>Sets priority of all threads in group to the given value.
+    ///  </summary>
+    procedure SetPriorities(const Priority: TThreadPriority);
     ///  <summary>Waits for each thread to terminate, subject to a timeout.
     ///  </summary>
     ///  <param name="Timeout">Cardinal [in] Timeout in ms.</param>
@@ -168,6 +171,14 @@
   Result := WaitFor(Timeout);
 end;
 
+procedure TThreadGroup.SetPriorities(const Priority: TThreadPriority);
+var
+  Thread: TThread;
+begin
+  for Thread in fThreads do
+    Thread.Priority := Priority;
+end;
+
 procedure TThreadGroup.Start;
 var
   Thread: TThread;
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.