pthread_setprio

This commit is contained in:
red-prig 2023-01-04 20:49:41 +03:00
parent 21464abe56
commit 0a3d651d6b
2 changed files with 15 additions and 7 deletions

View File

@ -1264,6 +1264,8 @@ begin
lib^.set_proc($8345530717C9CAED,@ps4_sceKernelGetCurrentCpu);
lib^.set_proc($D6D2B21BB465309A,@ps4_scePthreadGetprio);
lib^.set_proc($6B63FDC1819E66F7,@ps4_pthread_setprio);
lib^.set_proc($5B41E99B65F4B8F1,@ps4_scePthreadSetprio);
lib^.set_proc($3F8D644D6512DC42,@ps4_scePthreadGetschedparam);

View File

@ -73,6 +73,8 @@ function ps4_scePthreadGetaffinity(_pthread:pthread;mask:PQWORD):Integer; SysV_
function ps4_sceKernelGetCurrentCpu():Integer; SysV_ABI_CDecl;
function ps4_scePthreadGetprio(_pthread:pthread;prio:PInteger):Integer; SysV_ABI_CDecl;
function ps4_pthread_setprio(_pthread:pthread;prio:Integer):Integer; SysV_ABI_CDecl;
function ps4_scePthreadSetprio(_pthread:pthread;prio:Integer):Integer; SysV_ABI_CDecl;
function ps4_scePthreadGetschedparam(_pthread:pthread;policy:PInteger;param:PSceKernelSchedParam):Integer; SysV_ABI_CDecl;
@ -862,16 +864,15 @@ begin
Result:=0;
end;
function ps4_scePthreadSetprio(_pthread:pthread;prio:Integer):Integer; SysV_ABI_CDecl;
Var
function ps4_pthread_setprio(_pthread:pthread;prio:Integer):Integer; SysV_ABI_CDecl;
var
r:Integer;
begin
if (_pthread=nil) then Exit(SCE_KERNEL_ERROR_EINVAL);
if (_pthread=nil) then Exit(EINVAL);
if (prio>767) then prio:=767;
if (prio<256) then prio:=256;
if (prio>767) then Exit(EINVAL);
if (prio<256) then Exit(EINVAL);
//Writeln('scePthreadSetprio:',prio);
r:=(((767-prio)*30) div 511);
r:=PRIORITY_TABLE[r];
@ -879,11 +880,16 @@ begin
_sig_lock;
if not System.ThreadSetPriority(_pthread^.handle,r) then
begin
Result:=SCE_KERNEL_ERROR_ESRCH;
Result:=ESRCH;
end;
_sig_unlock;
end;
function ps4_scePthreadSetprio(_pthread:pthread;prio:Integer):Integer; SysV_ABI_CDecl;
begin
Result:=px2sce(ps4_pthread_setprio(_pthread,prio));
end;
//ThreadGetPriority = -15 and 15. :0..30
function ps4_scePthreadGetschedparam(_pthread:pthread;policy:PInteger;param:PSceKernelSchedParam):Integer; SysV_ABI_CDecl;
Var