pascalabcnet/InstallerSamples/Experimental/OMPSamples/Write Critical.pas
Mikhalkovich Stanislav e5b1dbdb95 Изменена реализация Halt - для ЦЗА uhfabrb gjl Цшт 11 (долго закрывалось окно)
Исправлена ошибка в XLSX.pas
Исправлена ошибка в AnimRotate в WPFObjects
Переупорядочены примеры
2022-04-12 16:31:00 +03:00

27 lines
875 B
ObjectPascal
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Вывод в параллельной секции без использования критических секций
// и с их использованием. В первом случае из-за параллельного доступа
// к разделяемому ресурсу возможно, что строки будут выводиться
// на одной строке, и в произвольно порядке. Во втором случае такого не будет.
begin
{$omp parallel sections}
begin
begin
WriteLn('Thread 1 started');
end;
begin
WriteLn('Thread 2 started');
end;
end;
{$omp parallel sections}
begin
begin
{$omp critical a}
WriteLn('Thread 1 started');
end;
begin
{$omp critical a}
WriteLn('Thread 2 started');
end;
end;
end.