当前位置: 首页>>代码示例>>C++>>正文


C++ sceKernelStartThread函数代码示例

本文整理汇总了C++中sceKernelStartThread函数的典型用法代码示例。如果您正苦于以下问题:C++ sceKernelStartThread函数的具体用法?C++ sceKernelStartThread怎么用?C++ sceKernelStartThread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sceKernelStartThread函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: bgm_volume

Psp2Audio::Psp2Audio() :
	bgm_volume(0)
{

	// Creating mutexs
	BGM_Mutex = sceKernelCreateSema("BGM Mutex", 0, 1, 1, NULL);
	SFX_Mutex = sceKernelCreateSema("SFX Mutex", 0, 0, 1, NULL);
	SFX_Mutex_ID = sceKernelCreateSema("SFX Mutex for ID read", 0, 1, 1, NULL);

	// Starting audio thread for BGM
	BGM_Thread = sceKernelCreateThread("BGM Thread", &streamThread, 0x10000100, 0x10000, 0, 0, NULL);
	int res = sceKernelStartThread(BGM_Thread, sizeof(BGM_Thread), &BGM_Thread);
	if (res != 0){
		Output::Error("Failed to init audio thread (0x%x)", res);
		return;
	}

	// Starting audio threads for SFX
	for (int i=0;i < AUDIO_CHANNELS; i++){
		sfx_threads[i] = sceKernelCreateThread("SFX Thread", &sfxThread, 0x10000100, 0x10000, 0, 0, NULL);
		int res = sceKernelStartThread(sfx_threads[i], sizeof(sfx_threads[i]), &sfx_threads[i]);
		if (res != 0){
			Output::Error("Failed to init audio thread (0x%x)", res);
			return;
		}
	}

}
开发者ID:ChristianBreitwieser,项目名称:easyrpg-libretro,代码行数:28,代码来源:audio_psp2.cpp

示例2: testThreadsEnded

void testThreadsEnded() {
	int thread1, thread2, thread3, thread4;
	
	// Thread1 will stop returning the function and sceKernelWaitThreadEnd will be executed after the thread have ended.
	thread1 = sceKernelCreateThread("threadEndedFunction1", (void *)&threadEndedFunction1, 0x12, 0x10000, 0, NULL);

	// Thread1 will stop with sceKernelExitThread and sceKernelWaitThreadEnd will be executed after the thread have ended.
	thread2 = sceKernelCreateThread("threadEndedFunction2", (void *)&threadEndedFunction2, 0x12, 0x10000, 0, NULL);

	// Thread3 will stop after a while so it will allow to execute sceKernelWaitThreadEnd before it ends.
	thread3 = sceKernelCreateThread("threadEndedFunction3", (void *)&threadEndedFunction3, 0x12, 0x10000, 0, NULL);
	
	// Thread4 won't start never, so sceKernelWaitThreadEnd can be executed before thread is started.
	thread4 = sceKernelCreateThread("threadEndedFunction4", NULL, 0x12, 0x10000, 0, NULL);

	sceKernelStartThread(thread1, 0, NULL);
	sceKernelStartThread(thread2, 0, NULL);
	sceKernelStartThread(thread3, 0, NULL);
	
	// This waits 5ms and supposes both threads (1 and 2) have ended. Thread 3 should have not ended. Thread 4 is not going to be started.
	sceKernelDelayThread(2 * 1000);

	printf("Threads.EndedExpected\n");
	
	sceKernelWaitThreadEnd(thread1, NULL);
	printf("Thread1.Ended\n");
	sceKernelWaitThreadEnd(thread2, NULL);
	printf("Thread2.Ended\n");
	sceKernelWaitThreadEnd(thread3, NULL);
	printf("Thread3.Ended\n");
	sceKernelWaitThreadEnd(thread4, NULL);
	printf("Thread4.NotStartedSoEnded\n");
}
开发者ID:mrcmunir,项目名称:cspspemu,代码行数:33,代码来源:threads.c

示例3: main

int main(int argc, char **argv) {
	int result;
	int check_not_update_value = 7;
	SceKernelSemaInfo info;
	
	sema = sceKernelCreateSema("sema1", 0, 0, 2, NULL);
	
	sceKernelReferSemaStatus(sema, &info);
	PRINT_SEMAPHORE(sema, info);
	
	threads[0] = sceKernelCreateThread("Thread-0", (void *)&threadFunction, 0x12, 0x10000, 0, NULL);
	threads[1] = sceKernelCreateThread("Thread-1", (void *)&threadFunction, 0x12, 0x10000, 0, NULL);
	threads[2] = sceKernelCreateThread("Thread-2", (void *)&threadFunction, 0x12, 0x10000, 0, NULL);
	threads[3] = sceKernelCreateThread("Thread-3", (void *)&threadFunction, 0x12, 0x10000, 0, NULL);
	threads[4] = sceKernelCreateThread("Thread-4", (void *)&threadFunction2, 0x12, 0x10000, 0, NULL);
	
	schedf("VALUE-INVARIANT:%d\n", check_not_update_value);
	
	sceKernelStartThread(threads[0], 1, (void*)&test[1]);
	sceKernelStartThread(threads[1], 2, NULL);
	sceKernelStartThread(threads[2], 0, (void*)&test[0]);
	sceKernelStartThread(threads[3], sizeof(int), (void*)&test[4]);
	sceKernelStartThread(threads[4], sizeof(int), &check_not_update_value);

	sceKernelDelayThread(10 * 1000);
	
	schedf("---\n");
	sceKernelReferSemaStatus(sema, &info);
	PRINT_SEMAPHORE(sema, info);
	schedf("---\n");
	sceKernelSignalSema(sema, 1);
	
	sceKernelDelayThread(10 * 1000);

	schedf("---\n");
	sceKernelReferSemaStatus(sema, &info);
	PRINT_SEMAPHORE(sema, info);
	schedf("---\n");

	sceKernelSignalSema(sema, 1);
	
	sceKernelDelayThread(10 * 1000);

	schedf("---\n");
	sceKernelReferSemaStatus(sema, &info);
	PRINT_SEMAPHORE(sema, info);
	schedf("---\n");
	
	result = sceKernelDeleteSema(sema);
	schedf("%08X\n", result);
	result = sceKernelDeleteSema(sema);
	schedf("%08X\n", result);
	
	schedf("VALUE-INVARIANT:%d\n", check_not_update_value);
	flushschedf();
	
	return 0;
}
开发者ID:HomerSp,项目名称:pspautotests,代码行数:58,代码来源:semaphores.c

示例4: psp_audio_init

void
psp_audio_init()
{
  psp_audio_chid = sceAudioChReserve(-1, 1024, 0);
  psp_audio_thid = sceKernelCreateThread( "audio_thread",(void*)&psp_audio_thread,0x12,0x10000,0,NULL);
	sceKernelStartThread( psp_audio_thid, 0, 0);

  MP3_Init();

  psp_cdaudio_chid = sceAudioChReserve(-1, 1024, 0);
  psp_cdaudio_thid = sceKernelCreateThread( "cdaudio_thread",(void*)&psp_cdaudio_thread,0x12,0x10000,0,NULL);
	sceKernelStartThread( psp_cdaudio_thid, 0, 0);
}
开发者ID:kerheol,项目名称:dingux-hugo,代码行数:13,代码来源:psp_audio.c

示例5: xSetupCallbacks

extern int xSetupCallbacks()
{
    int thid = sceKernelCreateThread("xCallbackThread", xCallbackThread, 0x11, 0xFA0, PSP_THREAD_ATTR_USER, 0);
    if(thid >= 0) sceKernelStartThread(thid, 0, 0);
    x_running = 1;
    return thid;
}
开发者ID:Falaina,项目名称:cspspemu,代码行数:7,代码来源:xlib.c

示例6: kernel_loadExec

int kernel_loadExec(const char *file, int argc, char** argv)
{
	u32 k1;
	k1 = pspSdkSetK1(0);
	
	// Store file name
	strcpy(exefile, file);
	
	// Concat argument strings
	paramlength = 0;
	
	// argv[0]
	strcpy(parameters, file);
	paramlength = strlen(file) + 1;
	
	// Rest of the arguments
	int i;
	for (i = 0; i < argc; i++)
	{
	  strcpy(&parameters[paramlength], argv[i]);
	  paramlength += (strlen(argv[i]) + 1);
	}
	
    SceUID thid = sceKernelCreateThread("launcher_thread", launcher_thread, 0x20, 0xFA0, 0, 0);
    if (thid > -1)
      thid = sceKernelStartThread(thid, 0, 0);
	
	pspSdkSetK1(k1);
	return 0;
}
开发者ID:AlanDrake,项目名称:ags,代码行数:30,代码来源:main.c

示例7: testCheckStackLayout

void testCheckStackLayout(const char *title, int argSize, u32 attr) {
	char argLengthTemp[0x1000];
	memset(argLengthTemp, 0xAB, sizeof(argLengthTemp));

	// First create the thread to wipe the stack area, that way we can see what it'd look like clean.
	SceUID stackCheckThread = sceKernelCreateThread("stackCheck", &stackCheckFunc, 0x10, 0x1000, attr, NULL);
	stackCheckInfo.size = sizeof(stackCheckInfo);
	sceKernelReferThreadStatus(stackCheckThread, &stackCheckInfo);
	sceKernelTerminateDeleteThread(stackCheckThread);
	memset(stackCheckInfo.stack, 0xCC, stackCheckInfo.stackSize);

	stackCheckName = title;
	stackCheckThread = sceKernelCreateThread("stackCheck", &stackCheckFunc, 0x10, 0x1000, attr, NULL);
	sceKernelStartThread(stackCheckThread, argSize, argLengthTemp);
	sceKernelWaitThreadEnd(stackCheckThread, NULL);

	u32 *stack = (u32 *) stackCheckInfo.stack;
	stack[1] = 0xFF1337FF;

	sceKernelTerminateDeleteThread(stackCheckThread);

	if (stack[1] != 0xFF1337FF) {
		schedf("    %s: WARNING: stack cleared to something after delete: %08x.\n", stackCheckName, stack[1]);
	}

	checkpoint("%s", title);
}
开发者ID:Raimoo,项目名称:pspautotests,代码行数:27,代码来源:start.c

示例8: initDisp

void initDisp()
{
  // Load images
  img.back = loadImage("graphics/back.png",G2D_SWIZZLE);
  img.tileset = loadImage("graphics/tileset.png",G2D_SWIZZLE);
  img.gsquare = loadImage("./graphics/gsquare.png",G2D_SWIZZLE);
  img.banner = loadImage("./graphics/genesis.png",G2D_SWIZZLE);
  // Init libraries
  intraFontInit();
  font = intraFontLoad("flash0:/font/ltn8.pgf",INTRAFONT_CACHE_MED);
  bigfont = intraFontLoad("flash0:/font/ltn0.pgf",INTRAFONT_CACHE_MED);
  seriffont = intraFontLoad("flash0:/font/ltn1.pgf",INTRAFONT_CACHE_MED);
  intraFontSetEncoding(font,INTRAFONT_STRING_UTF8);
  intraFontSetEncoding(bigfont,INTRAFONT_STRING_UTF8);
  intraFontSetEncoding(seriffont,INTRAFONT_STRING_UTF8);
  // Start display thread
  SceUID thid = sceKernelCreateThread("disp_thread",dispThread,0x10,0x1000,
                                      THREAD_ATTR_USER | THREAD_ATTR_VFPU,0);
  if (thid < 0)
  {
    throwException("Can't create the display thread\n");
  }
  if (sceKernelStartThread(thid,0,0))
  {
    throwException("Can't start the display thread\n");
  }
}
开发者ID:IgorMac,项目名称:gSquare,代码行数:27,代码来源:disp.c

示例9: module_start

/* Entry point */
int module_start(SceSize args, void *argp)
{
	int thid;
	int retv;

	retv = sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
	if(retv){
		return 0;
	}
	retv = sceUsbStart(HOSTFSDRIVER_NAME, 0, 0);
	if(retv){
		return 0;
	}
	retv = sceUsbActivate(HOSTFSDRIVER_PID);

	usbAsyncRegister(ASYNC_SHELL, &g_endp);
	usbAsyncRegister(ASYNC_STDOUT, &g_stdin);
	usbWaitForConnect();

	retv = stdioTtyInit();
	stdioInstallStdoutHandler(usbStdoutPrint);
	stdioInstallStderrHandler(usbStderrPrint);

	printk("Usbshell Start!\n");

	/* Create a high priority thread */
	thid = sceKernelCreateThread("USBShell", main_thread, 12, 0x2000, 0, NULL);
	if(thid >= 0)
	{
		sceKernelStartThread(thid, args, argp);
	}
	return 0;
}
开发者ID:yin8086,项目名称:psplinkusb,代码行数:34,代码来源:main.c

示例10: setup_callbacks

static void setup_callbacks (void)
{
     extern void directfb_dummy(void);
     extern void directfbwm_default(void);
//     extern void IDirectFBImageProvider_DFIFF_ctor(void);
     extern void IDirectFBImageProvider_GIF_ctor(void);
     extern void IDirectFBImageProvider_JPEG_ctor(void);
     extern void IDirectFBImageProvider_PNG_ctor(void);
//     extern void IDirectFBFont_DGIFF_ctor(void);
//     extern void IDirectFBFont_FT2_ctor(void);

     directfb_dummy();
     directfbwm_default();
//     IDirectFBImageProvider_DFIFF_ctor();
     IDirectFBImageProvider_GIF_ctor();
     IDirectFBImageProvider_JPEG_ctor();
     IDirectFBImageProvider_PNG_ctor();
//     IDirectFBFont_DGIFF_ctor();
//     IDirectFBFont_FT2_ctor();


	int id;

	if ((id = sceKernelCreateThread("update_thread", update_thread, 0x11, 0xFA0, 0, 0)) >= 0)
		sceKernelStartThread(id, 0, 0);
}
开发者ID:Distrotech,项目名称:DirectFB,代码行数:26,代码来源:psp-setup.c

示例11: MP3ME_Load

int MP3ME_Load(char *fileName){
    MP3ME_filePos = 0;
    MP3ME_playingSpeed = 0;
    MP3ME_isPlaying = 0;

    getcwd(audioCurrentDir, 256);

    //initFileInfo(&MP3ME_info);
    strcpy(MP3ME_fileName, fileName);
    if (MP3MEgetInfo() != 0){
        strcpy(MP3ME_fileName, "");
        return ERROR_OPENING;
    }

    releaseAudio();
    if (setAudioFrequency(OUTPUT_BUFFER_SIZE/4, MP3ME_info.hz, 2) < 0){
        MP3ME_End();
        return ERROR_INVALID_SAMPLE_RATE;
    }

    MP3ME_thid = -1;
    MP3ME_eof = 0;
    MP3ME_thid = sceKernelCreateThread("decodeThread", decodeThread, THREAD_PRIORITY, DEFAULT_THREAD_STACK_SIZE, PSP_THREAD_ATTR_USER, NULL);
    if(MP3ME_thid < 0)
        return ERROR_CREATE_THREAD;

    sceKernelStartThread(MP3ME_thid, 0, NULL);
    return OPENING_OK;
}
开发者ID:DavisDev,项目名称:lightmp3,代码行数:29,代码来源:mp3playerME.c

示例12: sizeof

static void *psp_audio_init(const char *device,
      unsigned rate, unsigned latency)
{
   psp1_audio_t* psp;
   
   (void)device;
   (void)latency;

  psp = (psp1_audio_t*)calloc(1, sizeof(psp1_audio_t));

   if (!psp)
      return NULL;

   /* Cache aligned, not necessary but helpful. */
   psp->buffer      = (uint32_t*)
      memalign(64, AUDIO_BUFFER_SIZE * sizeof(uint32_t));
   memset(psp->buffer, 0, AUDIO_BUFFER_SIZE * sizeof(uint32_t));

   psp->zeroBuffer  = (uint32_t*)
      memalign(64, AUDIO_OUT_COUNT   * sizeof(uint32_t));
   memset(psp->zeroBuffer, 0, AUDIO_OUT_COUNT * sizeof(uint32_t));

   psp->readPos     = 0;
   psp->writePos    = 0;
   psp->rate        = rate;
   psp->thread      = sceKernelCreateThread
      ("audioMainLoop", audioMainLoop, 0x08, 0x10000, 0, NULL);
   psp->nonblocking = false;

   psp->running     = true;
   sceKernelStartThread(psp->thread, sizeof(psp1_audio_t*), &psp);

   return psp;
}
开发者ID:CautiousAlbino,项目名称:RetroArch,代码行数:34,代码来源:psp1_audio.c

示例13: SetupCallbacks

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
    int thid = 0;
    thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, PSP_THREAD_ATTR_USER, 0);
    if(thid >= 0)
        sceKernelStartThread(thid, 0, 0);
    return thid;
}
开发者ID:pspdevelopment,项目名称:PSPDrone05Rel,代码行数:8,代码来源:main.c

示例14: _start

/**
 * Startup thread
 *
 * Creates the main program thread based on variables defined by the program.
 *
 * @param args - Size (in bytes) of arguments passed to the program by the kernel.
 * @param argp - Pointer to arguments passed by the kernel.
 */
int _start(SceSize args, void *argp)
{
	if (&sce_newlib_nocreate_thread_in_start != NULL) {
		/* The program does not want main() to be run in a seperate thread. */
		_main(args, argp);
		return 1;
	}

	int priority = DEFAULT_THREAD_PRIORITY;
	unsigned int attribute = DEFAULT_THREAD_ATTRIBUTE;
	unsigned int stackSize = DEFAULT_THREAD_STACK_KB_SIZE * 1024;
	const char *threadName = DEFAULT_MAIN_THREAD_NAME;

	if (&sce_newlib_priority != NULL) {
		priority = sce_newlib_priority;
	}
	if (&sce_newlib_attribute != NULL) {
		attribute = sce_newlib_attribute;
	}
	if (&sce_newlib_stack_kb_size != NULL) {
		stackSize = sce_newlib_stack_kb_size * 1024;
	}
	if (&sce_newlib_main_thread_name != NULL) {
		threadName = sce_newlib_main_thread_name;
	}

	SceUID thid;
	thid = sceKernelCreateThread(threadName, (void *) _main, priority, stackSize, attribute, 0);
	sceKernelStartThread(thid, args, argp);

	return 0;
}
开发者ID:CDragu,项目名称:pspsdk,代码行数:40,代码来源:crt0_prx.c

示例15: testTryAllocThread

void testTryAllocThread(const char *title, u32 attr, u32 requestBytes, u32 initialBytes) {
	schedf("%s: ", title);

	SceUID vpl = sceKernelCreateVpl("vpl", PSP_MEMORY_PARTITION_USER, attr, 0x100, NULL);

	// This way we have some allocated + free.
	void *data;
	sceKernelAllocateVpl(vpl, initialBytes, &data, NULL);

	SceUID allocThread = sceKernelCreateThread("allocThread", &allocFunc, 0x12, 0x1000, 0, NULL);
	sceKernelStartThread(allocThread, sizeof(SceUID), &vpl);
	sceKernelDelayThread(400);

	int result = sceKernelTryAllocateVpl(vpl, requestBytes, &data);
	schedf("L2 ");
	sceKernelDelayThread(600);

	sceKernelDeleteVpl(vpl);
	sceKernelWaitThreadEnd(allocThread, NULL);
	sceKernelTerminateDeleteThread(allocThread);

	if (result == 0) {
		schedf("OK (thread=%08X)\n", schedulingResult);
	} else {
		schedf("Failed (thread=%08X, main=%08X)\n", schedulingResult, result);
	}
}
开发者ID:JulianoAmaralChaves,项目名称:pspautotests,代码行数:27,代码来源:try.c


注:本文中的sceKernelStartThread函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。