I'm really new to multithreading, I've looked at the tutorial in the wiki. And I've got a few questions.
1. a mutex is used so only one thread can read / write on whatever is between
And it's only used when reading / writing shared resources like the data class in the example, right?
2. What I want to do is have a thread which handles all input, but I can't get it to work. I tried adding an ALLEGRO_EVENT ev, to the data class. and copy the ALLEGRO_EVENT in the main loop to the ALLEGRO_EVENT in the data class. like this:
Is there anything wrong with this?
3. In the input_thread function I've got:
When the mutex is locked in the main loop, and I'm copying the ev to the data.ev, is the thread waiting for the mutex to be unlocked in the main before continuing with "blah blah".