(NaCl) Create a thread for game logic. Fixes for file io, mutexes and threads.

Fixes for file io, mutexes and threads.
New thread for game logic. This thread calls into the main/pepper thread
in order to make ppapi calls.
Some synchronisation issues remain before file io will work reliably,
but main.cs script has sometimes managed to load and begin to execute.
Need to implement Platform::dumpDirectories in order to be able to scan
modules.
Need to implement writing to files.
Fix File::open sync problem

The initialCount for the semaphore needs to be 0 so the logic thread
blocks on the pepper thread.
NaClLocalFile no longer has a semaphore member, instead it releases the
semaphore which file::open acquires.
(NaCl) Alt-Enter opens a html window showing Torque console log. Implement file writing.
Further work on NaCl file writing.

Set PP_FILEOPENFLAG_TRUNCATE for Write access files.
Handle WriteAppend access.