CodeSnip Old Code (SVN)
A repository for source code snippets, designed with Pascal in mind.
Brought to you by:
delphidabbler
--- 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;