libthr: small refactoring on stack allocation