Threading
Monkey Archive Forums/Monkey Projects/Threading
| ||
So, I made a threading module for Monkey. It's essentially a clone of POSIX threads, so go read up on Mutexes and CondVars. Checked into Diddy repository (but a separate module): http://code.google.com/p/diddy/source/browse/#svn%2Ftrunk%2Fsrc%2Fthreading Example: http://code.google.com/p/diddy/source/browse/trunk/examples/Threading/threadTest.monkey Currently supported targets: MonkeyMax! :) GLFW (Windows and Mac) stdcpp (untested) iOS Android TODO: HTML5 (tricky, but I might be able to with web workers) XNA (once I bother to learn threading in .NET) Never TODO: Flash, because it doesn't support threading. Go go beta test! Edit: The feature table in the comments of threading.monkey got messed up with tab characters. I'll fix it with the next commit. |
| ||
Hi Samah, great stuff! Would threading solve the input lag problem on ios devices when using vblank? BTW, for a future project I may need my app to stay on the background and show an alert sometimes. I have not looked in to it myself yet, but any help (paid if needed) on the subject would be appreciated. Thanks! |
| ||
@Playniax: Would threading solve the input lag problem on ios devices when using vblank? Can't say I've heard of that, could you elaborate a bit? Also I've looked at cancelling threads on Android (using thread.interrupt()) and it kind of works... I'm a little worried about mutexes though since they're only ever unlocked by the developer and would be left locked if the thread were cancelled. Might be able to remedy this if Mark adds exceptions (and a finally block). |
| ||
http://stackoverflow.com/questions/10202259/cadisplaylink-causes-the-lag-between-touchesbegan-and-touchesended You can find a bunch of stuff about this cadisplaylink and input lag on google. So nothing on keeping your Monkey app on the background for alerts? :) |
| ||
Monkey app on the background for alerts? What type of alerts? Do you mean notifications? If so you don't keep your app "awake", iOS receives a notification for your app and starts it (if you want) automatically. |
| ||
Implemented cancelling threads for Android. Not sure how I'm going to do the other targets (if I can). We'll see once XNA is done. |
| ||
@therevills: Not sure yet. I am still waiting for details for the app but what I do know is that it needs to notify the user from time to time with information using location data and network / database stuff and I would love to use Monkey for it. I think it's better to await more details before I do more posts about it :) Thanks! |
| ||
Samah are you sure your not Brucey in disguise :D good stuff! |
| ||
Hahah nah... he's been surprisingly absent from the Monkey scene. :) |
| ||
This could be useful for loading images and loading save game files while making sure the phone doesnt think the game has crashed right? |
| ||
Yep, but I'm not sure if you'll be able to preload images in a separate thread. You can load the data into system memory, but I think piping it to the GPU memory will need to be done on the rendering thread still. Give it a shot! |