Views: 1,611,768 | Main | Rules/FAQ | Memberlist | Active users | Last posts | Calendar | Stats | Online users | Search | 12-03-24 05:22 PM |
Guest: |
0 users reading Homebrew coding pitfalls | 1 bot |
Main - Homebrew discussion - Homebrew coding pitfalls | Hide post layouts | New reply |
StapleButter |
| ||
Member blarg Level: 30 Posts: 31/184 EXP: 151609 Next: 14260 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
Threading
Threading on the 3DS is cooperative. That means that threads in your app need to be responsible and not take all the CPU time. Calling any system function (anything that uses SVC calls) triggers scheduling and gives other threads a chance to run. However, if you have a thread that does time-consuming operations without any system call, it will prevent other threads from running until it terminates or does a system call. In such cases, you should insert regular dummy system calls (for example svcSleepThread(1)) within the operations. This restriction only applies to threads from the same process on the same CPU core. Memory allocation When passing buffers to GPU or CSND calls, they must be allocated with linearAlloc(). Writing assembly code Take note of this when writing assembly code in a userland app. Code goes in .text, data goes in .data. Mess this up and you'll crash. It may seem common sense, but it is important on a system like the 3DS. The 3DS security implies that .text is read-only and code can't execute from .data. (in particular, you may run into this issue if you're porting ASM code from GBA/DS homebrew) ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
Main - Homebrew discussion - Homebrew coding pitfalls | Hide post layouts | New reply |
Page rendered in 0.012 seconds. (2048KB of memory used) MySQL - queries: 26, rows: 63/63, time: 0.006 seconds. Acmlmboard 2.064 (2018-07-20) © 2005-2008 Acmlm, Xkeeper, blackhole89 et al. |