|
This thread is locked; no one can reply to it. |
1
2
|
Multithreading Related Problems |
Elias
Member #358
May 2000
|
From what I've read the point of 100Hz or 120Hz monitors is different... a large amount of movies uses 24 FPS. On a 60Hz monitor that can't be smoothly displayed without stutter since not each frame can be displayed for the same time (unless you do some kind of interpolation - which leads to different artifacts). On 100 Hz or 120 Hz it looks completely smooth however (each single source frame is displayed for 4 or 5 frames respectively). -- |
RPG Hacker
Member #12,492
January 2011
|
Yeah, I reduced the timer to 100 FPS now. Seems to be the best solution. Anything above is overkill, really. J-Gamer said: If the render thread has an event queue that listens to a user event source from the logic thread, you can send events from the logic thread to the render thread trough al_emit_user_event. The queue in the render thread will automatically get the event. That is exactly what I intend to do. Don't know if I made another impression. All I need to know is if event queues are thread-safe (in other words: if one thread can edit/fill an event queue while another is reading it) or if I need to protect them from simultaneous access. Of course I could read AND clear the event queue in the rendering thread, but in my opinion that's inconvenient, so as long as it's not unsafe I prefer to clear the event queue in the logic thread. Or in other words: Whenver the logic threads emits a new user event, I want it to clear the last one afterwards (probably with al_get_next_event(), whereas I use al_peek_next_event() in the rendering thread).
|
Elias
Member #358
May 2000
|
Event queues are thread safe. -- |
RPG Hacker
Member #12,492
January 2011
|
Alright, thanks. That's all for now.
|
Audric
Member #907
January 2001
|
Even if the allegro functions are thread safe, the way you describe isn't. You can't have two threads read the same queue, each at their own speed. |
RPG Hacker
Member #12,492
January 2011
|
I'll always make sure that the rendering thread has at least one valid event to work with (since I'll use al_peek_next_event()), so as long as simultaneously reading/editing the queue itself doesn't cause errors I'll be fine.
|
|
1
2
|