refactor
new locking. but maybe buggy. ruby compile OK
new locking. many bugfixes
Merge branch 'topic/counting_lock' into v1-devel