Fixing pthreadglue

This commit is contained in:
Francisco Javier Trujillo Mata
2024-03-17 14:55:09 +01:00
parent 0fda058623
commit 5c6cc731e3
3 changed files with 18 additions and 3 deletions

View File

@@ -339,8 +339,9 @@ pte_osResult pte_osThreadWaitForEnd(pte_osThreadHandle threadHandle)
while (1) {
SceKernelThreadRunStatus info;
/* Poll task to see if it has ended */
/* Prepare info before be use in sceKernelReferThreadRunStatus */
memset(&info,0,sizeof(info));
info.size = sizeof(info);
sceKernelReferThreadRunStatus(threadHandle, &info);
@@ -355,6 +356,9 @@ pte_osResult pte_osThreadWaitForEnd(pte_osThreadHandle threadHandle)
if (pThreadData != NULL) {
SceUID osResult;
/* Prepare semInfo before be use in sceKernelReferSemaStatus */
memset(&semInfo, 0, sizeof(semInfo));
semInfo.size = sizeof(semInfo);
osResult = sceKernelReferSemaStatus(pThreadData->cancelSem, &semInfo);
if (osResult == SCE_KERNEL_ERROR_OK) {
if (semInfo.currentCount > 0) {
@@ -390,7 +394,9 @@ int pte_osThreadGetPriority(pte_osThreadHandle threadHandle)
{
SceKernelThreadInfo thinfo;
thinfo.size = sizeof(SceKernelThreadInfo);
/* Prepare info before be use in sceKernelReferThreadRunStatus */
memset(&thinfo,0,sizeof(thinfo));
thinfo.size = sizeof(thinfo);
sceKernelReferThreadStatus(threadHandle, &thinfo);
return thinfo.currentPriority;
@@ -435,6 +441,9 @@ pte_osResult pte_osThreadCheckCancel(pte_osThreadHandle threadHandle)
pThreadData = __getThreadData(threadHandle);
if (pThreadData != NULL) {
/* Prepare semInfo before be use in sceKernelReferSemaStatus */
memset(&semInfo, 0, sizeof(semInfo));
semInfo.size = sizeof(semInfo);
osResult = sceKernelReferSemaStatus(pThreadData->cancelSem, &semInfo);
if (osResult == SCE_KERNEL_ERROR_OK) {
@@ -687,6 +696,9 @@ pte_osResult pte_osSemaphoreCancellablePend(pte_osSemaphoreHandle semHandle, uns
if (pThreadData != NULL) {
SceUID osResult;
/* Prepare semInfo before be use in sceKernelReferSemaStatus */
memset(&semInfo, 0, sizeof(semInfo));
semInfo.size = sizeof(semInfo);
osResult = sceKernelReferSemaStatus(pThreadData->cancelSem, &semInfo);
if (osResult == SCE_KERNEL_ERROR_OK) {
if (semInfo.currentCount > 0) {

View File

@@ -158,7 +158,9 @@ void *__getTlsStructFromThread(SceUID thid)
int numMatches;
thinfo.size = sizeof(SceKernelThreadInfo);
/* Prepare thinfo before be use in sceKernelReferThreadRunStatus */
memset(&thinfo,0,sizeof(thinfo));
thinfo.size = sizeof(thinfo);
sceKernelReferThreadStatus(thid, &thinfo);
numMatches = sscanf(thinfo.name,"pthread%04d__%x", &thrNum, &ptr);

View File

@@ -130,6 +130,7 @@ static void initialize()
int thid = sceKernelGetThreadId();
SceKernelThreadInfo info;
memset(&info, 0, sizeof(info));
info.size = sizeof(info);
int ret = sceKernelReferThreadStatus(thid, &info);