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


C++ sceKernelDelayThread函数代码示例

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


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

示例1: main

extern "C" int main(int argc, char *argv[]) {
	SceUID vtimer = sceKernelCreateVTimer("test", NULL);

	checkpointNext("Objects");
	checkpoint("  Normal: %08x", sceKernelStopVTimer(vtimer));
	checkpoint("  Twice: %08x", sceKernelStopVTimer(vtimer));
	checkpoint("  NULL: %08x", sceKernelStopVTimer(0));
	checkpoint("  Invalid: %08x", sceKernelStopVTimer(0xDEADBEEF));
	sceKernelDeleteVTimer(vtimer);
	checkpoint("  Deleted: %08x", sceKernelStopVTimer(vtimer));

	vtimer = sceKernelCreateVTimer("test", NULL);
	checkpointNext("Resetting");

	sceKernelStartVTimer(vtimer);
	sceKernelDelayThread(1000);
	sceKernelStopVTimer(vtimer);
	sceKernelDelayThread(1000);
	sceKernelStartVTimer(vtimer);
	sceKernelDelayThread(1000);
	sceKernelStopVTimer(vtimer);
	sceKernelDelayThread(1000);
	sceKernelStartVTimer(vtimer);
	sceKernelDelayThread(1000);
	sceKernelStopVTimer(vtimer);

	checkpoint("  Start/Stop 3 times: %dms", (int)(sceKernelGetVTimerTimeWide(vtimer) / 1000));
	checkpoint("  Base: %lld", sceKernelGetVTimerBaseWide(vtimer));

	sceKernelDeleteVTimer(vtimer);
	return 0;
}
开发者ID:Raimoo,项目名称:pspautotests,代码行数:32,代码来源:stop.cpp

示例2: main

extern "C" int main(int argc, char *argv[]) {
	checkpointNext("Normal (FIFO):");
	{
		SceUID fpl = sceKernelCreateFpl("fpl", PSP_MEMORY_PARTITION_USER, 0, 0x100, 1, NULL);
		void *data;
		sceKernelAllocateFpl(fpl, &data, NULL);
		FplWaitThread wait1("waiting thread 1", fpl, NO_TIMEOUT, 300, 0x30);
		FplWaitThread wait2("waiting thread 2", fpl, NO_TIMEOUT, 300, 0x34);
		FplWaitThread wait3("waiting thread 3", fpl, NO_TIMEOUT, 300, 0x31);
		sceKernelFreeFpl(fpl, data);
		schedfFpl(fpl);
		sceKernelDelayThread(200000);
		sceKernelDeleteFpl(fpl);
	}

	checkpointNext("Priority:");
	{
		SceUID fpl = sceKernelCreateFpl("fpl", PSP_MEMORY_PARTITION_USER, PSP_FPL_ATTR_PRIORITY, 0x100, 1, NULL);
		void *data;
		sceKernelAllocateFpl(fpl, &data, NULL);
		FplWaitThread wait1("waiting thread 1", fpl, NO_TIMEOUT, 300, 0x30);
		FplWaitThread wait2("waiting thread 2", fpl, NO_TIMEOUT, 300, 0x34);
		FplWaitThread wait3("waiting thread 3", fpl, NO_TIMEOUT, 300, 0x31);
		sceKernelFreeFpl(fpl, data);
		schedfFpl(fpl);
		sceKernelDelayThread(200000);
		sceKernelDeleteFpl(fpl);
	}
	return 0;
}
开发者ID:KentuckyCompass,项目名称:pspautotests,代码行数:30,代码来源:priority.cpp

示例3: checkVblankInterruptHandler

void checkVblankInterruptHandler() {
	int counter = 0, last_counter = 0;
	int results[3], n;

	//pspDebugScreenInit();
	pspDebugScreenPrintf("Starting...\n");
	printf("Starting...\n");

	sceKernelRegisterSubIntrHandler(PSP_VBLANK_INT, 0, vblank_handler_counter, &counter);
	sceKernelDelayThread(80000);
	results[0] = counter;
	printf("NotEnabled: Counter:%s\n", (counter == 0) ? "zero" : "non-zero"); // 0. Not enabled yet.
	
	sceKernelEnableSubIntr(PSP_VBLANK_INT, 0);
	sceKernelDelayThread(160000);
	results[1] = counter;
	printf("Enabled (GreaterThan2): Counter:%s\n", (counter >= 2) ? "greater" : "no greater"); // n. Already enabled.

	sceKernelReleaseSubIntrHandler(PSP_VBLANK_INT, 0);
	last_counter = counter;
	sceKernelDelayThread(80000);
	results[2] = counter;
	printf("Disabled (NotChangedAfterDisabled): %s\n", (last_counter != counter) ? "changed" : "not changed"); // n. Disabled.
	
	for (n = 0; n < 3; n++) {
		//printf("Output %d:%d\n", n, results[n]);
		pspDebugScreenPrintf("%d\n", results[n]);
	}
}
开发者ID:Falaina,项目名称:cspspemu,代码行数:29,代码来源:intr.c

示例4: display_begin_frame

/**
 * display_begin_frame:  Begin processing for a frame.
 *
 * [Parameters]
 *     None
 * [Return value]
 *     None
 */
void display_begin_frame(void)
{
    sceKernelDelayThread(0);  // Seems to be needed for the buffer swap to work
    while (swap_pending) {
        sceKernelDelayThread(100);  // 0.1ms
    }

    vram_next_alloc = vram_spare_ptr;

    guStart(GU_DIRECT, display_list);

    /* We don't use a depth buffer, so disable depth buffer writing */
    guDepthMask(GU_TRUE);

    /* Clear the work surface--make sure to use the base pointer here, not
     * the effective pointer, lest we stomp on spare VRAM while using the
     * second buffer */
    guDrawBuffer(GU_PSM_8888, surfaces[work_surface], DISPLAY_STRIDE);
    guDisable(GU_SCISSOR_TEST);
    guClear(GU_COLOR_BUFFER_BIT);
    guCommit();

    /* Register the effective work surface pointer */
    guDrawBuffer(GU_PSM_8888, display_work_buffer(), DISPLAY_STRIDE);

    /* Set up drawing area parameters (we set the depth parameters too,
     * just in case a custom drawing routine wants to use 3D coordinates) */
    guViewport(2048, 2048, display_width, display_height);
    guOffset(2048 - display_width/2, 2048 - display_height/2);
    guScissor(0, 0, display_width, display_height);
    guEnable(GU_SCISSOR_TEST);
    guDepthRange(65535, 0);
    guDisable(GU_DEPTH_TEST);

}
开发者ID:DavideD,项目名称:BizHawk,代码行数:43,代码来源:display.c

示例5: testVTimerGetSimple

void testVTimerGetSimple() {
	SceUID vtimer1;

	printf("sceKernelCreateVTimer:%08X\n", vtimer1 = sceKernelCreateVTimer("VTIMER1", NULL));
	
	sceKernelDelayThread(10000);
	
	printf("sceKernelGetVTimerTimeWide: %lld\n", sceKernelGetVTimerTimeWide(vtimer1) / 10000);

	printf("sceKernelStartVTimer:0x%08X\n", sceKernelStartVTimer(vtimer1));

	sceKernelDelayThread(10000);
	printf("sceKernelGetVTimerTimeWide: %lld\n", sceKernelGetVTimerTimeWide(vtimer1) / 10000);
	printf("sceKernelStopVTimer:0x%08X\n", sceKernelStopVTimer(vtimer1));

	printf("sceKernelStartVTimer:0x%08X\n", sceKernelStartVTimer(vtimer1));

	sceKernelDelayThread(10000);
	printf("sceKernelGetVTimerTimeWide: %lld\n", sceKernelGetVTimerTimeWide(vtimer1) / 10000);
	printf("sceKernelStopVTimer:0x%08X\n", sceKernelStopVTimer(vtimer1));
	printf("sceKernelStopVTimer:0x%08X\n", sceKernelStopVTimer(vtimer1));

	printf("sceKernelGetVTimerTimeWide: %lld\n", sceKernelGetVTimerTimeWide(vtimer1) / 10000);
	
	printf("sceKernelCancelVTimerHandler:0x%08X\n", sceKernelCancelVTimerHandler(vtimer1));
}
开发者ID:Falaina,项目名称:cspspemu,代码行数:26,代码来源:vtimer.c

示例6: sceNetInetSocket

/* Start a client */
int JSocket::start_client(const char *szIpAddr){
#ifdef NETWORK_SUPPORT
 int sock;
  sockaddr_in addrListen;
  int error;

  sock = sceNetInetSocket(AF_INET, SOCK_STREAM, 0);
 if (sock <= 0){
  printf("socket returned $%x\n", sock);
  sceKernelDelayThread(500*1000);
  return sock;
 }

  addrListen.sin_family = AF_INET;
  addrListen.sin_addr.s_addr  = inet_addr(szIpAddr);
  addrListen.sin_port = htons(SERVER_PORT);

  int err = sceNetInetConnect(sock, (sockaddr *)&addrListen, sizeof(addrListen));
  if (err != 0){
   printf("Unable to connect!\n");
   printf("connect returned $%x\n", err);
   printf("  errno=$%x\n", sceNetInetGetErrno());
   sceKernelDelayThread(500*1000);
   return err;
 }

 connected = 1;

 while(1){
   readWrite(sock);
 }
 #endif
 return 0;
}
开发者ID:zwvc,项目名称:wagic-x,代码行数:35,代码来源:JSocket.cpp

示例7: MainThread

static int MainThread( SceSize args, void *argp )
{
	hookDisplay();

	sceKernelDcacheWritebackInvalidateAll();
	sceKernelIcacheInvalidateAll();

	unsigned int paddata_old = 0;
	SceCtrlData paddata;
	
	sceKernelDelayThread(10000);

	
	while(1)
	{
		sceCtrlPeekBufferPositive(&paddata, 1);
		
		if(paddata.Buttons != paddata_old)
		{
			//press "note" button and magick begin
			if(paddata.Buttons & PSP_CTRL_NOTE)
			{
				//can parse command list
				can_parse = 1;
				
			}
		}
		paddata_old = paddata.Buttons;
		sceKernelDelayThread(10000);
	}

	return( 0 );
}
开发者ID:DragonNeos,项目名称:psplamb,代码行数:33,代码来源:main.c

示例8: execPriorityTests

void execPriorityTests(int attr, int deleteInstead) {
	SceUID threads[5];
	int test[5] = {1, 2, 3, 4, 5};
	int result;

	sceKernelCreateLwMutex(&workarea, "mutex1", attr, 1, NULL);

	int i;
	for (i = 0; i < 5; i++) {
		threads[i] = CREATE_PRIORITY_THREAD(threadFunction, 0x16 - i);
		sceKernelStartThread(threads[i], sizeof(int), (void*)&test[i]);
	}

	// This one intentionally is an invalid unlock.
	sceKernelDelayThread(1000);
	printf("Unlocking...\n");
	result = sceKernelUnlockLwMutex(&workarea, 2);
	sceKernelDelayThread(5000);
	printf("Unlocked 2? %08X\n", result);

	if (!deleteInstead)
	{
		sceKernelDelayThread(1000);
		printf("Unlocking...\n");
		result = sceKernelUnlockLwMutex(&workarea, 1);
		sceKernelDelayThread(5000);
		printf("Unlocked 1? %08X\n", result);
	}

	sceKernelDelayThread(1000);
	printf("Delete: %08X\n", sceKernelDeleteLwMutex(&workarea));
	printf("\n\n");
}
开发者ID:HomerSp,项目名称:pspautotests,代码行数:33,代码来源:priority.c

示例9: main

extern "C" int main(int argc, char *argv[]) {
	vtimer = sceKernelCreateVTimer("cancel", NULL);

	testCancel("Normal", vtimer);
	testCancel("Twice", vtimer);
	testCancel("NULL", 0);
	testCancel("Invalid", 0xDEADBEEF);
	sceKernelDeleteVTimer(vtimer);
	testCancel("Deleted", vtimer);

	vtimer = sceKernelCreateVTimer("delete", NULL);
	sceKernelStartVTimer(vtimer);
	testCancel("Started", vtimer);

	sceKernelSetVTimerHandlerWide(vtimer, 1, &basicHandler, (void *)0xABCD1337);
	testCancel("With handler", vtimer);

	SceKernelSysClock t = {1, 0};
	sceKernelSetVTimerHandler(vtimer, &t, &cancelHandler, (void *)0xABCD1337);
	sceKernelDelayThread(1000);
	testCancel("After cancel handler", vtimer);

	sceKernelSetVTimerHandlerWide(vtimer, 1, &zeroHandler, (void *)0xABCD1337);
	sceKernelDelayThread(1000);
	schedfVTimer(vtimer);
	testCancel("After return zero handler", vtimer);

	return 0;
}
开发者ID:Raimoo,项目名称:pspautotests,代码行数:29,代码来源:cancelhandler.cpp

示例10: 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

示例11: uninstall_permanent_patch

void uninstall_permanent_patch(void)
{
	int ret;

	do {
		ret = sceIoRemove(VSHMAIN);

		if(ret != 0) {
			printf("Delete %s failed\n", VSHMAIN);
			sceKernelDelayThread(1000000L);
		}
	} while(ret != 0);

	do {
		ret = copy_file(VSHORIG, VSHMAIN);

		if(ret != 0) {
			printf("Copy %s to %s failed 0x%08X\n", VSHORIG, VSHMAIN, ret);
			sceKernelDelayThread(1000000L);
		}
	} while(ret != 0);

	do {
		ret = sceIoRemove(VSHORIG);

		if(ret != 0) {
			printf("Delete %s failed\n", VSHTEMP);
			sceKernelDelayThread(1000000L);
		}
	} while(ret != 0);

	sceIoRemove(VSHTEMP);
}
开发者ID:AnnaKozlowska,项目名称:procfw,代码行数:33,代码来源:main.c

示例12: 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

示例13: messagebubble

static int messagebubble(int buttonif, const char *message)
{
    sceDisplayWaitVblankStart();
    sceKernelDelayThread(100 * 1000);
    ShowMessageDialog(message, buttonif);
    sceKernelDelayThread(300 * 1000);
    sceUtilityMsgDialogShutdownStart();
    return 1;
}
开发者ID:pavel-demin,项目名称:lua-player-plus,代码行数:9,代码来源:luaSystem.c

示例14: main

extern "C" int main(int argc, char *argv[]) {
	loadPsmfPlayer();

	sceMpegInit();
	checkpointNext("Init");

	checkpointNext("Players:");
	testGetAudioData("  Initial", createPsmfPlayerInitial());
	testGetAudioData("  Standby", createPsmfPlayerStandby(TEST_VIDEO_FILENAME));
	testGetAudioData("  Deleted", createPsmfPlayerDeleted());
	// Crashes.
	//testGetAudioData("  NULL", NULL);
	SceUID *psmfPlaying = createPsmfPlayerPlaying(TEST_VIDEO_FILENAME);
	testGetAudioData("  Playing", psmfPlaying);

	// Force the video ahead a bit.
	warmUpVideo(psmfPlaying);
	sceKernelDelayThread(16000);

	testGetAudioData("  Twice", psmfPlaying);
	SceUID psmf2 = *psmfPlaying;
	sceKernelDelayThread(16000);
	testGetAudioData("  Copy", &psmf2);
	testGetAudioData("  Finished", createPsmfPlayerAudioFinished(TEST_VIDEO_FILENAME));

	psmfPlaying = createPsmfPlayerPlaying(TEST_VIDEO_FILENAME);
	warmUpVideo(psmfPlaying);

	checkpointNext("Params:");
	// Crashes.
	//testGetAudioData("  NULL audioData", psmfPlaying, false);

	checkpointNext("Frame write");
	scePsmfPlayerChangePlayMode(psmfPlaying, 3, 0);
	prepScanAudioData();
	testGetAudioData("  Paused 1", psmfPlaying);
	doScanAudioData();
	sceKernelDelayThread(16000);
	prepScanAudioData();
	testGetAudioData("  Paused 2", psmfPlaying);
	doScanAudioData();

	SceUID *psmfFinished = createPsmfPlayerAudioFinished(TEST_VIDEO_FILENAME);
	prepScanAudioData();
	testGetAudioData("  Finished", psmfFinished);
	doScanAudioData();

	checkpointNext("Video sync better priority:");
	testAudioDataVideoSync(0x17);
	checkpointNext("Video sync worse priority:");
	testAudioDataVideoSync(0x28);

	sceMpegFinish();
	unloadPsmfPlayer();
	return 0;
}
开发者ID:achurch,项目名称:pspautotests,代码行数:56,代码来源:getaudiodata.cpp

示例15: execPriorityTests

static void execPriorityTests(int attr, int changePriority) {
	printf("For attr %08X%s:\n", attr, changePriority ? " and changed priorities" : "");

	schedulingLogPos = 0;

	SceUID threads[7];
	int test[7] = {1, 2, 3, 4, 5, 6, 7};

	mbx = sceKernelCreateMbx("mbx1", attr, NULL);
	PRINT_MBX(mbx);

	sendMbx(mbx, 0x20);
	sendMbx(mbx, 0x10);

	int i;
	for (i = 0; i < 7; i++) {
		threads[i] = CREATE_PRIORITY_THREAD(threadFunction, 0x18 - i);
		sceKernelStartThread(threads[i], sizeof(int), (void*)&test[i]);
	}

	sceKernelDelayThread(10 * 1000);

	// What we're gonna do now is change the threads' priorities to see whether
	// priority at time of wait (already happened) or at time of send matters.
	if (changePriority) {
		for (i = 0; i < 7; i++) {
			sceKernelChangeThreadPriority(threads[i], 0x18 - 7 + i);
		}
		printf("Priorities reversed.  Have a nice day.\n");
	}

	schedf("---\n");
	PRINT_MBX(mbx);
	schedf("---\n");
	sendMbx(mbx, 0x15);

	sceKernelDelayThread(10 * 1000);

	schedf("---\n");
	PRINT_MBX(mbx);
	schedf("---\n");

	sendMbx(mbx, 0x20);
	sendMbx(mbx, 0x10);

	sceKernelDelayThread(10 * 1000);

	schedf("---\n");
	PRINT_MBX(mbx);
	schedf("---\n");

	sceKernelDeleteMbx(mbx);
	schedf("\n\n");

	printf("%s", schedulingLog);
}
开发者ID:HomerSp,项目名称:pspautotests,代码行数:56,代码来源:priority.c


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