(psp pthreads) Buildfixes

This commit is contained in:
twinaphex 2017-12-27 07:48:04 +01:00
parent a57df7d43f
commit c4f06f2ef2
5 changed files with 350 additions and 443 deletions

View File

@ -29,9 +29,9 @@
#ifndef _TLS_HELPER_H_
#define _TLS_HELPER_H_
#include "pte_osal.h"
#include "../../pte_osal.h"
/// @todo document..
/* @todo document.. */
pte_osResult pteTlsGlobalInit(int maxEntries);
void * pteTlsThreadInit(void);

File diff suppressed because it is too large Load Diff

View File

@ -37,9 +37,6 @@ typedef SceUID pte_osMutexHandle;
#define OS_IS_HANDLE_VALID(x) ((x) > 0)
#define OS_MAX_SIMUL_THREADS 10
#define OS_DEFAULT_PRIO 11
@ -47,12 +44,12 @@ typedef SceUID pte_osMutexHandle;
#define OS_MIN_PRIO 17
#define OS_MAX_PRIO 32
//#define HAVE_THREAD_SAFE_ERRNO
#if 0
#define HAVE_THREAD_SAFE_ERRNO
#endif
#define POLLING_DELAY_IN_us 100
#define OS_MAX_SEM_VALUE 254
int PspInterlockedExchange(int *ptarg, int val);

View File

@ -1,12 +1,9 @@
#ifndef _OS_SUPPORT_H_
#define _OS_SUPPORT_H_
// Platform specific one must be included first
/* Platform specific one must be included first */
#include "psp_osal.h"
#include "pte_generic_osal.h"
#endif // _OS_SUPPORT_H
#endif /* _OS_SUPPORT_H */

View File

@ -5,7 +5,6 @@
#include <pspsdk.h>
#include <pspctrl.h>
PSP_MODULE_INFO("Pthread Test", 0, 1, 1);
extern void pte_test_main();
@ -17,56 +16,49 @@ extern void pte_test_main();
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common)
{
sceKernelExitGame();
return 0;
sceKernelExitGame();
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp)
{
int cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
int cbid;
sceKernelSleepThreadCB();
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void)
{
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if (thid >= 0)
{
int thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if (thid >= 0)
sceKernelStartThread(thid, 0, 0);
}
return thid;
return thid;
}
int main(void)
{
SceCtrlData pad;
SceCtrlData pad;
pspDebugScreenInit();
SetupCallbacks();
pspDebugScreenInit();
SetupCallbacks();
pte_test_main();
pte_test_main();
while (1)
{
while (1)
{
sceCtrlReadBufferPositive(&pad, 1);
if (pad.Buttons & PSP_CTRL_UP)
{
printf("Exiting...\n");
return 0;
}
{
printf("Exiting...\n");
return 0;
}
}
return 0;
}
return 0;
}