mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 03:18:13 +00:00
PSP: Truncate thread name when passing to sceKernelCreateThread
(cherry picked from commit c64518f300
)
This commit is contained in:

committed by
Sam Lantinga

parent
5b64be0810
commit
fe47f5cc30
@@ -32,6 +32,8 @@
|
|||||||
#include <pspkerneltypes.h>
|
#include <pspkerneltypes.h>
|
||||||
#include <pspthreadman.h>
|
#include <pspthreadman.h>
|
||||||
|
|
||||||
|
#define PSP_THREAD_NAME_MAX 32
|
||||||
|
|
||||||
static int ThreadEntry(SceSize args, void *argp)
|
static int ThreadEntry(SceSize args, void *argp)
|
||||||
{
|
{
|
||||||
SDL_RunThread(*(SDL_Thread **)argp);
|
SDL_RunThread(*(SDL_Thread **)argp);
|
||||||
@@ -44,6 +46,7 @@ bool SDL_SYS_CreateThread(SDL_Thread *thread,
|
|||||||
{
|
{
|
||||||
SceKernelThreadInfo status;
|
SceKernelThreadInfo status;
|
||||||
int priority = 32;
|
int priority = 32;
|
||||||
|
char thread_name[PSP_THREAD_NAME_MAX];
|
||||||
|
|
||||||
// Set priority of new thread to the same as the current thread
|
// Set priority of new thread to the same as the current thread
|
||||||
status.size = sizeof(SceKernelThreadInfo);
|
status.size = sizeof(SceKernelThreadInfo);
|
||||||
@@ -51,7 +54,12 @@ bool SDL_SYS_CreateThread(SDL_Thread *thread,
|
|||||||
priority = status.currentPriority;
|
priority = status.currentPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
thread->handle = sceKernelCreateThread(thread->name, ThreadEntry,
|
SDL_strlcpy(thread_name, "SDL thread", PSP_THREAD_NAME_MAX);
|
||||||
|
if (thread->name) {
|
||||||
|
SDL_strlcpy(thread_name, thread->name, PSP_THREAD_NAME_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
thread->handle = sceKernelCreateThread(thread_name, ThreadEntry,
|
||||||
priority, thread->stacksize ? ((int)thread->stacksize) : 0x8000,
|
priority, thread->stacksize ? ((int)thread->stacksize) : 0x8000,
|
||||||
PSP_THREAD_ATTR_VFPU, NULL);
|
PSP_THREAD_ATTR_VFPU, NULL);
|
||||||
if (thread->handle < 0) {
|
if (thread->handle < 0) {
|
||||||
|
Reference in New Issue
Block a user