Hi, I wanted to know, whether there's a way to generate timer event on my own. The thing is that I have something like:
while (ti->run){ al_wait_for_event(queue, &ev); if (ti->run/* && (!*(ti->suspended))*/){ if (ti->updater->update()) *(ti->refresh) = true; } }
This code runs in separate thread. Now when I need to close the application, I just set ti->run to false and wait for the thread to exit (actually it is Win32 thread, I do not use allegro wrapper for this one, but I don't think that matters). The point is, that in the worst case I have to wait for the whole timer interval till the thread closes (because of it waiting for the event). So after setting ti->run from sepparate thread, I would also like to escape the al_wait_for_event (by generating the event on my own for example...). Now I suppose I could create my own event type (somehow - I know Allegro supports it but I haven't found out any tutorial on that...), but I really do not want to compliate things, so fireing the timer event on my own would suffice.
Thanks
I doubt Allegro provides such a feature. I'd just use a user event, they are easy enough (see ex_user_events for more ideas). Just create your own source, register it and fire off a user event:
OK, I'll try that out...
Thanks.
//edit: Works perfectly!