Skip to content

Commit

Permalink
- Increase thread stack size.
Browse files Browse the repository at this point in the history
  • Loading branch information
Extrems committed Feb 11, 2024
1 parent 149cad7 commit 54e6e3e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cube/swiss/source/devices/filemeta.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ static void *meta_thread_func(void *arg) {

void meta_thread_start() {
if (devices[DEVICE_CUR]->features & FEAT_THREAD_SAFE)
LWP_CreateThread(&meta_thread, meta_thread_func, NULL, NULL, 0, LWP_PRIO_NORMAL);
LWP_CreateThread(&meta_thread, meta_thread_func, NULL, NULL, 16*1024, LWP_PRIO_NORMAL);
}

void meta_thread_stop() {
Expand Down
13 changes: 6 additions & 7 deletions cube/swiss/source/gui/FrameBufferMagic.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,11 @@ GXTexObj m2loaderTexObj;
static char fbTextBuffer[256];

// Video threading vars
#define VIDEO_STACK_SIZE (1024*64)
#define VIDEO_STACK_SIZE (64*1024)
#define VIDEO_PRIORITY 100
static char video_thread_stack[VIDEO_STACK_SIZE];
static lwp_t video_thread = LWP_THREAD_NULL;
static mutex_t _videomutex = LWP_MUTEX_NULL;
static int threadAlive = 0;

enum VideoEventType
{
Expand Down Expand Up @@ -2049,7 +2048,7 @@ static void *videoUpdate(void *videoEventQueue) {
//int frames = 0;
//int framerate = 0;
//u32 lasttime = gettick();
while(threadAlive) {
while(video_thread == LWP_GetSelf()) {
whichfb ^= 1;
//frames++;
LWP_MutexLock(_videomutex);
Expand Down Expand Up @@ -2135,7 +2134,6 @@ void DrawInit() {
DrawAddChild(container, buttonPanel);
DrawPublish(container);
LWP_MutexInit(&_videomutex, 0);
threadAlive = 1;
LWP_CreateThread(&video_thread, videoUpdate, videoEventQueue, video_thread_stack, VIDEO_STACK_SIZE, VIDEO_PRIORITY);
}

Expand Down Expand Up @@ -2210,11 +2208,12 @@ void DrawLoadBackdrop() {
}

void DrawShutdown() {
LWP_MutexDestroy(_videomutex);
mutex_t mutex = _videomutex;
_videomutex = LWP_MUTEX_NULL;
threadAlive = 0;
LWP_JoinThread(video_thread, NULL);
LWP_MutexDestroy(mutex);
lwp_t thread = video_thread;
video_thread = LWP_THREAD_NULL;
LWP_JoinThread(thread, NULL);
GX_SetCurrentGXThread();
}

Expand Down

0 comments on commit 54e6e3e

Please sign in to comment.