-
-
Save devnoname120/55469a1cd904c3a7d8be685499f3995b to your computer and use it in GitHub Desktop.
Vita std::thread test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 2.8) | |
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) | |
if(DEFINED ENV{VITASDK}) | |
set(CMAKE_TOOLCHAIN_FILE "$ENV{VITASDK}/share/vita.toolchain.cmake" CACHE PATH "toolchain file") | |
else() | |
message(FATAL_ERROR "Please define VITASDK to point to your SDK path!") | |
endif() | |
endif() | |
set(SHORT_NAME ThreadTest) | |
project(${SHORT_NAME}) | |
include("${VITASDK}/share/vita.cmake" REQUIRED) | |
set(VITA_APP_NAME "Thread Test") | |
set(VITA_TITLEID "THRD00001") | |
set(VITA_VERSION "00.01") | |
# Default build type | |
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | |
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Default build" FORCE) | |
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release") # For CMake GUI | |
endif() | |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") | |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -Wno-sign-compare -Wno-unused-parameter -std=c++11") | |
add_executable(${SHORT_NAME} | |
main.cpp | |
) | |
target_link_libraries(${SHORT_NAME} | |
c | |
) | |
vita_create_self(${SHORT_NAME}.self ${SHORT_NAME} UNSAFE UNCOMPRESSED) | |
vita_create_vpk(${SHORT_NAME}.vpk ${VITA_TITLEID} ${SHORT_NAME}.self | |
VERSION ${VITA_VERSION} | |
NAME ${VITA_APP_NAME} | |
) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== THREADS === | |
THRD00001 | |
ID: 0x40010003 | |
Stop reason: 0x30002 (Undefined instruction exception) | |
Status: 0x1 (Running) | |
PC: 0x810a5702 (ThreadTest@1 + 0x62702) | |
SceCommonDialogWorker | |
ID: 0x40010073 | |
Stop reason: 0x0 (No reason) | |
Status: 0x8 (Waiting) | |
PC: 0xe0006584 (SceLibKernel@1 + 0x6304) | |
ID: 0x400100a7 | |
Stop reason: 0x0 (No reason) | |
Status: 0x10 () | |
PC: 0x810af348 (ThreadTest@1 + 0x6c348) | |
=== THREAD "THRD00001" <0x40010003> CRASHED (Undefined instruction exception) === | |
REGISTERS: | |
R0: 0x192b2f | |
R1: 0xdeadbeef | |
R2: 0xdeadbeef | |
R3: 0x4 | |
R4: 0x192b2f | |
R5: 0x81102068 | |
R6: 0x6 | |
R7: 0x55 | |
R8: 0x810b1074 | |
R9: 0xdeadbeef | |
R10: 0xdeadbeef | |
R11: 0xdeadbeef | |
R12: 0xdeadbeef | |
SP: 0x811c0f08 | |
PC: 0x810a5702 (ThreadTest@1 + 0x62702) | |
LR: 0x810a56c9 (ThreadTest@1 + 0x626c9) | |
STACK CONTENTS AROUND SP: | |
0x811c0ec8: 0xdeadbeef | |
0x811c0ecc: 0x81145d98 (ThreadTest@2 + 0x45d98) | |
0x811c0ed0: 0x1 | |
0x811c0ed4: 0x810a55cb (ThreadTest@1 + 0x625cb) | |
0x811c0ed8: 0x1 | |
0x811c0edc: 0x811004a4 (ThreadTest@2 + 0x4a4) | |
0x811c0ee0: 0x811004e7 (ThreadTest@2 + 0x4e7) | |
0x811c0ee4: 0x810a0c11 (ThreadTest@1 + 0x5dc11) | |
0x811c0ee8: 0x81102068 (ThreadTest@2 + 0x2068) | |
0x811c0eec: 0x6 | |
0x811c0ef0: 0x1 | |
0x811c0ef4: 0x81100a74 (ThreadTest@2 + 0xa74) | |
0x811c0ef8: 0x55 | |
0x811c0efc: 0x810b1074 (ThreadTest@1 + 0x6e074) | |
0x811c0f00: 0xdeadbeef | |
0x811c0f04: 0xdeadbeef | |
SP => 0x811c0f08: 0x811000e4 (ThreadTest@2 + 0xe4) | |
0x811c0f0c: 0x1 | |
0x811c0f10: 0x81100a74 (ThreadTest@2 + 0xa74) | |
0x811c0f14: 0x8109e101 (ThreadTest@1 + 0x5b101) | |
0x811c0f18: 0xffffffff | |
0x811c0f1c: 0x8105023b (ThreadTest@1 + 0xd23b) | |
0x811c0f20: 0x0 | |
0x811c0f24: 0x0 | |
0x811c0f28: 0x812050c0 | |
0x811c0f2c: 0x81205068 | |
0x811c0f30: 0x0 | |
0x811c0f34: 0x8104d375 (ThreadTest@1 + 0xa375) | |
0x811c0f38: 0x81100050 (ThreadTest@2 + 0x50) | |
0x811c0f3c: 0x8104d3ad (ThreadTest@1 + 0xa3ad) | |
0x811c0f40: 0x5 | |
0x811c0f44: 0x810500a1 (ThreadTest@1 + 0xd0a1) | |
0x811c0f48: 0x812050c0 | |
0x811c0f4c: 0x8110005c (ThreadTest@2 + 0x5c) | |
0x811c0f50: 0x81204f60 | |
0x811c0f54: 0x811c0f80 | |
0x811c0f58: 0x0 | |
0x811c0f5c: 0x81057cf9 (ThreadTest@1 + 0x14cf9) | |
0x811c0f60: 0x8104b743 (ThreadTest@1 + 0x8743) | |
0x811c0f64: 0x81100a74 (ThreadTest@2 + 0xa74) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <psp2/kernel/threadmgr.h> | |
#include <thread> | |
extern "C" | |
{ | |
unsigned int sleep(unsigned int seconds) | |
{ | |
sceKernelDelayThread(seconds*1000*1000); | |
return 0; | |
} | |
int usleep(useconds_t usec) | |
{ | |
sceKernelDelayThread(usec); | |
return 0; | |
} | |
void __sinit(struct _reent *); | |
} | |
__attribute__((constructor(101))) | |
void pthread_setup(void) | |
{ | |
pthread_init(); | |
__sinit(_REENT); | |
} | |
void someFunc() { | |
return; | |
} | |
int main() | |
{ | |
std::thread thrd(someFunc); | |
thrd.join(); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment