Closed kthakore closed 13 years ago
Author: ruoso Time: 1262649114 Field: status Value: closed
Author: ruoso Time: 1262649114 Field: resolution Value: fixed
Author: ruoso Time: 1262649114 Field: comment Value: In the end, the solution was to implement it using threads instead of coro::state, but it does work just fine.
SDL makes heavy use of callbacks, so it is important to make it work as coroutines, so that the code interrupted by a callback is reified later.
This also potentially solves the issue with threads and timer, since the timer thread could simply signalize the main thread to switch to a different coroutine, instead of trying to execute the code in the foreign thread...
Usually, for every callback in SDL there's always a pointer for "user defined data", this can be used to store the closure to be called, then the current interpreter state could be sent as a parameter to be reified at the end of the callback in a Continuation Passing Style.