fix gpio hal

- fix gpio api to support thread-safe