duktape: prevent wrongful termination of runaway thread
Add proper use of pthread lock/unlock around a section handing a condition variable to avoid race conditions.
When the race condition occurs it results in the following errors:
polkitd[6588]: Terminating runaway script after 15 seconds
polkitd[6588]: Error cancelling runaway JS killer thread: No such process
Signed-off-by: Laurent Gauthier laurent.gauthier@soccasys.com