本文整理汇总了C++中sceKernelSleepThreadCB函数的典型用法代码示例。如果您正苦于以下问题:C++ sceKernelSleepThreadCB函数的具体用法?C++ sceKernelSleepThreadCB怎么用?C++ sceKernelSleepThreadCB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sceKernelSleepThreadCB函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: and_thread
int and_thread(SceSize args, void *argp)
{
int result;
u32 outBits;
SceKernelThreadInfo info;
info.size = sizeof(SceKernelThreadInfo);
sceKernelReferThreadStatus (0, &info);
printf("thread '%-12s' sp %p pattern %08x START\n", info.name, info.stack, AND_PATTERN);
while(!done)
{
// 0x00FF00FF initPattern
// 0x000000FF should work - ok
// 0x00000FF0 should fail - ok
// 0x0000FF00 should fail - ok
outBits = 0xbaadc0de;
result = sceKernelWaitEventFlag(evid, AND_PATTERN, PSP_EVENT_WAITAND, &outBits, 0);
//result = sceKernelPollEventFlag(evid, AND_PATTERN, PSP_EVENT_WAITAND, &outBits);
printf("thread '%-12s' result %08x outBits %08x\n", info.name, result, (int)outBits);
sceKernelSleepThreadCB();
}
return 0;
}
示例2: CallbackThread
/* Callback thread */
int CallbackThread(SceSize args, void *argp)
{
int cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
示例3: update_thread
static
int update_thread (SceSize args, void *argp)
{
int cbid = sceKernelCreateCallback("Exit Callback", exit_callback, (void *) 0);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
示例4: CallbackThread
// Callback thread
int CallbackThread(SceSize args, void *argp) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", (void *) exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
cbid = sceKernelCreateCallback("Power Callback", (void *) power_callback, NULL);
scePowerRegisterCallback(0, cbid);
sceKernelSleepThreadCB();
return 0;
}
示例5: callbacks_thread
int callbacks_thread(unsigned int, void*)
{
int id;
id = sceKernelCreateCallback("exit_cb", callbacks_exit, NULL);
sceKernelRegisterExitCallback(id);
sceKernelSleepThreadCB();
return 0;
}
示例6: CallbackThread
// Thread to create the callbacks and then begin polling
int CallbackThread (int args, void *argp)
{
int cbid;
cbid = sceKernelCreateCallback ("Exit Callback", (SceKernelCallbackFunction)ExitCallback, NULL);
sceKernelRegisterExitCallback (cbid);
cbid = sceKernelCreateCallback ("Power Callback", (SceKernelCallbackFunction)PowerCallback, NULL);
scePowerRegisterCallback (0, cbid);
sceKernelSleepThreadCB ();
}
示例7: CallbackThread
/* Callback thread */
int CallbackThread(SceSize args, void *argp)
{
int cbid;
printf("\nCallback Thread Status:\n");
dump_threadstatus();
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
示例8: DEBUG_ENTER_FUNC
// this function gets called by PspThread when starting the new thread
void MasterGuRenderer::threadFunction() {
DEBUG_ENTER_FUNC();
// Create the callback. It should always get the pointer to MasterGuRenderer
_callbackId = sceKernelCreateCallback("Display Callback", guCallback, this);
if (_callbackId < 0) {
PSP_ERROR("failed to create display callback\n");
}
PSP_DEBUG_PRINT("created callback. Going to sleep\n");
sceKernelSleepThreadCB(); // sleep until we get a callback
}
示例9: psp_callback_thread
int
psp_callback_thread(SceSize args, void *argp)
{
int cid;
cid = sceKernelCreateCallback("Exit Call Back", psp_exit_callback, NULL);
sceKernelRegisterExitCallback(cid);
cid = sceKernelCreateCallback("Power Call Back", psp_power_callback, NULL);
//scePowerRegisterCallback(0,cid);
sceKernelSleepThreadCB();
return 0;
}
示例10: CallbackThread
/* Callback thread */
int CallbackThread(SceSize args, void *argp)
{
int cbid;
//SceKernelThreadInfo info;
//info.size = sizeof(SceKernelThreadInfo);
//sceKernelReferThreadStatus (0, &info);
//printf("thread '%-12s' sp %p w %08x START\n", info.name, info.stack, info.waitId);
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
示例11: callback_thread
/* Callback thread */
static int callback_thread(SceSize args, void *argp)
{
int cbid;
lprintf("callback_thread started with id %08x, priority %i\n",
sceKernelGetThreadId(), sceKernelGetThreadCurrentPriority());
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
cbid = sceKernelCreateCallback("Power Callback", power_callback, NULL);
scePowerRegisterCallback(0, cbid);
sceKernelSleepThreadCB();
return 0;
}
示例12: CallbackThread
/* Callback thread */
int CallbackThread(SceSize /*size*/, void *arg) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", (SceKernelCallbackFunction)exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
/* Set up callbacks for PSPIoStream */
cbid = sceKernelCreateCallback("Power Callback", (SceKernelCallbackFunction)power_callback, 0);
if (cbid >= 0) {
if (scePowerRegisterCallback(-1, cbid) < 0) {
PSP_ERROR("Couldn't register callback for power_callback\n");
}
} else {
PSP_ERROR("Couldn't create a callback for power_callback\n");
}
sceKernelSleepThreadCB();
return 0;
}
示例13: ExitCallbackThread
static int ExitCallbackThread(SceSize args, void *argp)
{
sceKernelRegisterExitCallback(sceKernelCreateCallback("HOME button Callback", exit_callback, NULL));
sceKernelSleepThreadCB();
return 0;
}
示例14: main
int main(int argc, char *argv[])
{
SceCtrlData pad;
int result;
int oldButtons = 0;
pspDebugScreenInit();
if (argc > 0) {
printf("Bootpath: %s\n", argv[0]);
}
printf("Triangle - Exit\n");
printf("Square - Set lower 16-bits\n");
printf("Circle - Clear lower 16-bits\n");
printf("Cross - Delay + refer status\n");
printf("R-Trigger - Cancel event flag\n\n");
printf("L-Trigger - Delete event flag\n\n");
SetupCallbacks();
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
evid = sceKernelCreateEventFlag("test_ef", PSP_EVENT_WAITMULTIPLE, INITIAL_PATTERN, 0);
//evid = sceKernelCreateEventFlag("test_ef", 0, INITIAL_PATTERN, 0);
printf("EVID: %08x pattern %08x\n", evid, INITIAL_PATTERN);
if (evid >= 0)
{
createStartThread("and", and_thread);
createStartThread("or", or_thread);
createStartThread("clear", clear_thread);
#if 0
// testing context switch timing
sceKernelSetEventFlag(evid, 0x0000FFFF);
//int buf[64]; for(;;) sceCtrlReadLatch(buf); // sceCtrlReadLatch does not context switch
for(;;) sceKernelDelayThread(0); // does not wait forever
#else
while(!done)
{
sceCtrlReadBufferPositive(&pad, 1); // context switch in here
int buttonDown = (oldButtons ^ pad.Buttons) & pad.Buttons;
if (buttonDown & PSP_CTRL_SQUARE)
{
result = sceKernelSetEventFlag(evid, 0x0000FFFF);
printf("\nsceKernelSetEventFlag result %08x\n", result);
printSceKernelEventFlagInfo(evid);
}
if (buttonDown & PSP_CTRL_CIRCLE)
{
//result = sceKernelClearEventFlag(evid, 0x0000FFFF); // bits to clear - bad
result = sceKernelClearEventFlag(evid, 0xFFFF0000); // bits to keep - ok
printf("\nsceKernelClearEventFlag result %08x\n", result);
printSceKernelEventFlagInfo(evid);
}
if (buttonDown & PSP_CTRL_CROSS)
{
printf("\nsceKernelDelayThreadCB ...\n");
sceKernelDelayThreadCB(1000);
printSceKernelEventFlagInfo(evid);
}
if (buttonDown & PSP_CTRL_RTRIGGER)
{
//result = sceKernelCancelEventFlag(evid, newPattern, addr);
result = sceKernelCancelEventFlag(evid, INITIAL_PATTERN, 0);
printf("sceKernelCancelEventFlag result %08x\n", result);
printSceKernelEventFlagInfo(evid);
}
if (buttonDown & PSP_CTRL_LTRIGGER)
{
//result = sceKernelCancelEventFlag(evid, newPattern, addr);
result = sceKernelDeleteEventFlag(evid);
printf("sceKernelDeleteEventFlag result %08x\n", result);
evid = 0;
}
if (buttonDown & PSP_CTRL_TRIANGLE)
done = 1;
oldButtons = pad.Buttons;
//sceKernelDelayThread(0); // ok, not infinite :)
}
#endif
}
else
{
printf("sceKernelCreateEventFlag failed %08x\n", evid);
sceKernelSleepThreadCB();
}
sceKernelExitGame();
return 0;
}