Advertisement
TheRouletteBoi

Fiber thread

Dec 11th, 2016
695
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.34 KB | None | 0 0
  1. //outputs this error
  2. //SNCLINK : error : '_gCellFiberPpuThreadLocalStorage' is TLS variable. PRX doesn't support TLS now!
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9. #include <cell\fiber\ppu_fiber.h>
  10. #include <cell/fiber/ppuUtilDefine.h>
  11. #include <cassert>
  12. #include <cell/fiber/ppuUtilRuntime.h>
  13.  
  14.  
  15. $(SCE_PS3_ROOT)\target\ppu\lib\libfiber_stub.a
  16.  
  17.  
  18. static int fiber_entry_Hello(uint64_t arg)
  19. {
  20.     printf("Hello, fiber!\n");
  21.  
  22.     return 0;
  23. }
  24.  
  25. void fiberRun()
  26. {
  27.  
  28.  
  29.     cellFiberPpuInitialize();
  30.     CellFiberPpuScheduler* scheduler = (CellFiberPpuScheduler*)memalign(CELL_FIBER_PPU_SCHEDULER_ALIGN, CELL_FIBER_PPU_SCHEDULER_SIZE);
  31.     CellFiberPpuSchedulerAttribute schedAttr;
  32.     cellFiberPpuSchedulerAttributeInitialize(&schedAttr);
  33.     schedAttr.debuggerSupport = true;
  34.     cellFiberPpuInitializeScheduler(scheduler, &schedAttr);
  35.     CellFiberPpu* fiberHello = (CellFiberPpu*)memalign(CELL_FIBER_PPU_ALIGN, CELL_FIBER_PPU_SIZE);
  36.     void* fiberHelloStack = memalign(CELL_FIBER_PPU_STACK_ALIGN, 2048);
  37.     CellFiberPpuAttribute attr;
  38.     cellFiberPpuAttributeInitialize(&attr);
  39.     strncpy(attr.name, "Sample Hello Fiber", CELL_FIBER_PPU_NAME_MAX_LENGTH);
  40.     cellFiberPpuCreateFiber(scheduler, fiberHello, fiber_entry_Hello, 0ULL, 1, fiberHelloStack, 2048, &attr);
  41.     cellFiberPpuRunFibers(scheduler);
  42.     int status;
  43.     cellFiberPpuJoinFiber(fiberHello, &status);
  44.  
  45.     free(fiberHello);
  46.     free(fiberHelloStack);
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement