XN_CORE_API XnStatus XnOSWaitForThreadExit(XN_THREAD_HANDLE ThreadHandle, XN_UINT32 nMilliseconds) { uint64_t rc; if (sys_ppu_thread_join(ThreadHandle, &rc) == CELL_OK) return XN_STATUS_OK; return XN_STATUS_OS_THREAD_WAIT_FAILED; }
int testplugin_stop(void) { sys_ppu_thread_t t; uint64_t exit_code; sys_ppu_thread_create(&t, testplugin_stop_thread, 0, 0, 0x2000, SYS_PPU_THREAD_CREATE_JOINABLE, STOP_THREAD_NAME); sys_ppu_thread_join(t, &exit_code); finalize_module(); _sys_ppu_thread_exit(0); return SYS_PRX_STOP_OK; }
int vsh_menu_stop(void) { sys_ppu_thread_t t; uint64_t exit_code; sys_ppu_thread_create(&t, vsh_menu_stop_thread, 0, 0, 0x2000, 1, STOP_THREAD_NAME); sys_ppu_thread_join(t, &exit_code); finalize_module(); _sys_ppu_thread_exit(0); return SYS_PRX_STOP_OK; }
/*********************************************************************** * stop thread ***********************************************************************/ static void vsh_menu_stop_thread(uint64_t arg) { done = 1; if(vsh_menu_tid != (sys_ppu_thread_t)-1) { uint64_t exit_code; sys_ppu_thread_join(vsh_menu_tid, &exit_code); } sys_ppu_thread_exit(0); }
int createThreadAndJoin(void (*func)(uint64_t), uint64_t arg=0) { uint64_t val; sys_ppu_thread_t thread; std::size_t stackSize = 4096; if (sys_ppu_thread_create(&thread, func, arg, 1500, stackSize, SYS_PPU_THREAD_CREATE_JOINABLE, "Worker")) { printf("[!] sys_ppu_thread_create: Something went wrong!\n"); exit(-1); } if (sys_ppu_thread_join(thread, &val)) { printf("[!] sys_ppu_thread_join: Something went wrong!\n"); exit(-1); } }
int32_t CellThread::Wait () { if(!Dead) { Dead = true; uint64_t result64; sys_ppu_thread_join(Thread, &result64); Result = (int32_t)result64; } return Result; }
int sampleSpursUtilSpuPrintfServiceFinalize(SampleUtilSpursPrintfService *service) { int ret; uint64_t exit_code; /* * */ ret = cellSpursDetachLv2EventQueue (service->spurs, SPU_PORT_PRINTF); if (ret) { printf ("cellSpursDetachLv2EventQueue failed %d\n", ret); return ret; } /* * send event for temination. */ ret = sys_event_port_send (service->terminating_port, 0, 0, 0); if (ret) { printf ("sys_event_port_send failed %d\n", ret); return ret; } /* wait for termination of the handler thread */ ret = sys_ppu_thread_join (service->spu_printf_handler, &exit_code); if (ret) { printf("sys_ppu_thread_join failed %d\n", ret); return ret; } /* Disconnect and destroy the terminating port */ ret = sys_event_port_disconnect(service->terminating_port); if (ret) { printf("sys_event_disconnect failed %d\n", ret); return ret; } ret = sys_event_port_destroy(service->terminating_port); if (ret) { printf("sys_event_port_destroy failed %d\n", ret); return ret; } /* clean event_queue for spu_printf */ ret = sys_event_queue_destroy (service->equeue, 0); if (ret) { printf("sys_event_queue_destroy failed %d\n", ret); return ret; } return CELL_OK; }
static void testplugin_stop_thread(uint64_t arg) { DPRINTF("testplugin_stop_thread\n"); done = 1; if (thread_id != (sys_ppu_thread_t)-1) { uint64_t exit_code; sys_ppu_thread_join(thread_id, &exit_code); } DPRINTF("Exiting stop thread!\n"); sys_ppu_thread_exit(0); }
static void ps3_audio_free(void *data) { uint64_t val; ps3_audio_t *aud = data; aud->quit_thread = true; ps3_audio_start(aud); sys_ppu_thread_join(aud->thread, &val); ps3_audio_stop(aud); cellAudioPortClose(aud->audio_port); cellAudioQuit(); fifo_free(aud->buffer); sys_lwmutex_destroy(&aud->lock); sys_lwmutex_destroy(&aud->cond_lock); sys_lwcond_destroy(&aud->cond); free(data); }