Skip to content

Commit

Permalink
- Added TPasMP.GetJobWorkerThreadIndex API
Browse files Browse the repository at this point in the history
  • Loading branch information
BeRo1985 committed Mar 23, 2018
1 parent 508c59a commit 1b3cb89
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/PasMP.pas
@@ -1,12 +1,12 @@
(******************************************************************************
* PasMP *
******************************************************************************
* Version 2018-01-18-11-33-0000 *
* Version 2018-03-23-10-18-0000 *
******************************************************************************
* zlib license *
*============================================================================*
* *
* Copyright (C) 2016-2017, Benjamin Rosseaux (benjamin@rosseaux.de) *
* Copyright (C) 2016-2018, Benjamin Rosseaux (benjamin@rosseaux.de) *
* *
* This software is provided 'as-is', without any express or implied *
* warranty. In no event will the authors be held liable for any damages *
Expand Down Expand Up @@ -2235,6 +2235,7 @@ TPasMP=class
class function DecodeJobTagFromJobFlags(const Flags:TPasMPUInt32):TPasMPUInt32; {$ifdef HAS_STATIC}static;{$endif}{$ifdef CAN_INLINE}inline;{$endif}
procedure Reset;
function CreateScope:TPasMPScope; {$ifdef fpc}{$ifdef CAN_INLINE}inline;{$endif}{$endif}
function GetJobWorkerThreadIndex:TPasMPInt32;
{$ifdef HAS_ANONYMOUS_METHODS}
function Acquire(const JobReferenceProcedure:TPasMPJobReferenceProcedure;const Data:pointer=nil;const ParentJob:PPasMPJob=nil;const Flags:TPasMPUInt32=0):PPasMPJob; overload;
{$endif}
Expand Down Expand Up @@ -12173,6 +12174,17 @@ function TPasMP.GetJobWorkerThread:TPasMPJobWorkerThread; {$ifdef UseThreadLocal
end;
{$endif}

function TPasMP.GetJobWorkerThreadIndex:TPasMPInt32;
var CurrentJobWorkerThread:TPasMPJobWorkerThread;
begin
CurrentJobWorkerThread:=GetJobWorkerThread;
if assigned(CurrentJobWorkerThread) then begin
result:=CurrentJobWorkerThread.fThreadIndex;
end else begin
result:=-1;
end;
end;

procedure TPasMP.WaitForWakeUp;
{$ifdef PasMPUseWakeUpConditionVariable}
var SavedWakeUpCounter:TPasMPInt32;
Expand Down

0 comments on commit 1b3cb89

Please sign in to comment.