mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 13:59:28 +02:00
* count the number of successfully started threads, and quit as soon as
those threads have finished (rather than waiting for the maximum number of threads that may have been started) git-svn-id: trunk@20003 -
This commit is contained in:
parent
64ce43d041
commit
4e053637d4
@ -46,13 +46,16 @@ function f(p : pointer) : ptrint;
|
||||
|
||||
var
|
||||
i : ptrint;
|
||||
started: longint;
|
||||
begin
|
||||
finished:=0;
|
||||
started:=0;
|
||||
|
||||
for i:=1 to threadcount do
|
||||
BeginThread({$ifdef fpc}@{$endif}f,pointer(i));
|
||||
if BeginThread({$ifdef fpc}@{$endif}f,pointer(i)) <> tthreadid(0) then
|
||||
inc(started);
|
||||
|
||||
while finished<threadcount do
|
||||
while finished<started do
|
||||
{$ifdef wince}sleep(10){$endif};
|
||||
writeln(finished);
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user