def emit_func(api, f):
p('void %(impl_name)s(afb_req req) noexcept {' % f)
- #p(' std::lock_guard<std::mutex> guard(binding_m);')
+ p(' std::lock_guard<std::mutex> guard(binding_m);')
p(' #ifdef ST')
p(' ST();')
p(' #endif')
p(' {}', '};')
def emit_binding(api):
- p('namespace {', '')
+ p('namespace {')
+ p('std::mutex binding_m;', '')
for func in api['functions']:
emit_func(api, func)
p('} // namespace', '')
for f in api['functions']:
p(' result_type %(name)s(' % f + ', '.join(map(lambda x: '%(type)s %(name)s' % x, f.get('args', []))) + ');')
p('};', '')
- p('} // namespace wm')
+ p('} // namespace wm', '')
# names must always be valid in c and unique for each function (that is its arguments)
# arguments will be looked up from json request, range checking needs to be implemented