atomspace: fix deadlock

This cures issues #393
Merge pull request #396 from linas/master

atomspace: fix deadlock