timeout.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. *
  3. * Embedded Linux library
  4. *
  5. * Copyright (C) 2011-2014 Intel Corporation. All rights reserved.
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. */
  22. #ifndef __ELL_TIMEOUT_H
  23. #define __ELL_TIMEOUT_H
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. #include <stdint.h>
  28. struct l_timeout;
  29. typedef void (*l_timeout_notify_cb_t) (struct l_timeout *timeout,
  30. void *user_data);
  31. typedef void (*l_timeout_destroy_cb_t) (void *user_data);
  32. struct l_timeout *l_timeout_create(unsigned int seconds,
  33. l_timeout_notify_cb_t callback,
  34. void *user_data, l_timeout_destroy_cb_t destroy);
  35. struct l_timeout *l_timeout_create_ms(uint64_t milliseconds,
  36. l_timeout_notify_cb_t callback,
  37. void *user_data, l_timeout_destroy_cb_t destroy);
  38. void l_timeout_modify(struct l_timeout *timeout,
  39. unsigned int seconds);
  40. void l_timeout_modify_ms(struct l_timeout *timeout,
  41. uint64_t milliseconds);
  42. void l_timeout_remove(struct l_timeout *timeout);
  43. void l_timeout_set_callback(struct l_timeout *timeout,
  44. l_timeout_notify_cb_t callback, void *user_data,
  45. l_timeout_destroy_cb_t destroy);
  46. #ifdef __cplusplus
  47. }
  48. #endif
  49. #endif /* __ELL_TIMEOUT_H */