lock.h 548 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef __LOCK_Hx__
  2. #define __LOCK_Hx__
  3. enum {
  4. LOCK_ID_DB=0,
  5. LOCK_ID_MQTT,
  6. LOCK_ID_MAIL,
  7. LOCK_ID_PARAS,
  8. LOCK_ID_SENSOR,
  9. LOCK_ID_BREAKER,
  10. LOCK_ID_NETSWITCH,
  11. LOCK_ID_POWER_TIMER,
  12. LOCK_ID_POWER_UPDATE,
  13. LOCK_ID_MAX
  14. };
  15. //static lock
  16. int lock_s_init(void);
  17. int lock_s_deinit(void);
  18. int lock_s_hold(int id);
  19. int lock_s_release(int id);
  20. //dynamic lock
  21. typedef unsigned long lock_t;
  22. lock_t lock_d_init(void);
  23. int lock_d_deinit(lock_t h);
  24. int lock_d_hold(lock_t h);
  25. int lock_d_release(lock_t h);
  26. #endif