mirror of
https://github.com/red-prig/fpPS4.git
synced 2024-11-23 06:19:57 +00:00
pthread_getschedparam, pthread_setschedparam
This commit is contained in:
parent
7f53558979
commit
4b7e4d37ec
@ -1269,7 +1269,10 @@ begin
|
||||
lib^.set_proc($6B63FDC1819E66F7,@ps4_pthread_setprio);
|
||||
lib^.set_proc($5B41E99B65F4B8F1,@ps4_scePthreadSetprio);
|
||||
|
||||
lib^.set_proc($148B37FD4413F6C8,@ps4_pthread_getschedparam);
|
||||
lib^.set_proc($3F8D644D6512DC42,@ps4_scePthreadGetschedparam);
|
||||
|
||||
lib^.set_proc($5ECF617620FBB000,@ps4_pthread_setschedparam);
|
||||
lib^.set_proc($A084454E3A082DB8,@ps4_scePthreadSetschedparam);
|
||||
|
||||
lib^.set_proc($08136D5CEA1E7FF1,@ps4_sched_get_priority_max);
|
||||
|
@ -78,7 +78,10 @@ function ps4_scePthreadGetprio(_pthread:pthread;prio:PInteger):Integer; SysV_AB
|
||||
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_pthread_getschedparam(_pthread:pthread;policy:PInteger;param:PSceKernelSchedParam):Integer; SysV_ABI_CDecl;
|
||||
function ps4_scePthreadGetschedparam(_pthread:pthread;policy:PInteger;param:PSceKernelSchedParam):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_pthread_setschedparam(_pthread:pthread;policy:Integer;param:PSceKernelSchedParam):Integer; SysV_ABI_CDecl;
|
||||
function ps4_scePthreadSetschedparam(_pthread:pthread;policy:Integer;param:PSceKernelSchedParam):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_sched_get_priority_max(policy:Integer):Integer; SysV_ABI_CDecl;
|
||||
@ -904,52 +907,44 @@ begin
|
||||
Result:=px2sce(ps4_pthread_setprio(_pthread,prio));
|
||||
end;
|
||||
|
||||
function ps4_scePthreadGetschedparam(_pthread:pthread;policy:PInteger;param:PSceKernelSchedParam):Integer; SysV_ABI_CDecl;
|
||||
Var
|
||||
r:Integer;
|
||||
function ps4_pthread_getschedparam(_pthread:pthread;policy:PInteger;param:PSceKernelSchedParam):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
if (_pthread=nil) or (policy=nil) or (param=nil) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
if (_pthread=nil) or (policy=nil) or (param=nil) then Exit(EINVAL);
|
||||
|
||||
policy^:=SCE_KERNEL_SCHED_RR;
|
||||
policy^:=_pthread^.Attr.sched_policy;
|
||||
param^.sched_priority:=_pthread^.Attr.prio;
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
_sig_lock;
|
||||
r:=System.ThreadGetPriority(_pthread^.handle);
|
||||
_sig_unlock;
|
||||
param^.sched_priority:=(r+15);
|
||||
function ps4_scePthreadGetschedparam(_pthread:pthread;policy:PInteger;param:PSceKernelSchedParam):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=px2sce(ps4_pthread_getschedparam(_pthread,policy,param));
|
||||
end;
|
||||
|
||||
function ps4_pthread_setschedparam(_pthread:pthread;policy:Integer;param:PSceKernelSchedParam):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
if (_pthread=nil) or (param=nil) then Exit(EINVAL);
|
||||
|
||||
Result:=ps4_pthread_setprio(_pthread,param^.sched_priority);
|
||||
if (Result<>0) then Exit;
|
||||
|
||||
_pthread^.Attr.sched_policy:=policy;
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
function ps4_scePthreadSetschedparam(_pthread:pthread;policy:Integer;param:PSceKernelSchedParam):Integer; SysV_ABI_CDecl;
|
||||
Var
|
||||
r:Integer;
|
||||
begin
|
||||
if (_pthread=nil) or (param=nil) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
|
||||
r:=param^.sched_priority;
|
||||
|
||||
if (r>30) then r:=30;
|
||||
if (r<0) then r:=0;
|
||||
|
||||
r:=PRIORITY_TABLE[r];
|
||||
|
||||
Result:=0;
|
||||
_sig_lock;
|
||||
if not System.ThreadSetPriority(_pthread^.handle,r) then
|
||||
begin
|
||||
Result:=SCE_KERNEL_ERROR_ESRCH;
|
||||
end;
|
||||
_sig_unlock;
|
||||
Result:=px2sce(ps4_pthread_setschedparam(_pthread,policy,param));
|
||||
end;
|
||||
|
||||
|
||||
function ps4_sched_get_priority_max(policy:Integer):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=30;
|
||||
Result:=SCE_KERNEL_PRIO_FIFO_HIGHEST;
|
||||
end;
|
||||
|
||||
function ps4_sched_get_priority_min(policy:Integer):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=0;
|
||||
Result:=SCE_KERNEL_PRIO_FIFO_LOWEST;
|
||||
end;
|
||||
|
||||
procedure ps4_scePthreadYield; SysV_ABI_CDecl;
|
||||
|
Loading…
Reference in New Issue
Block a user