diff options
author | michael bishop <cleverca22@gmail.com> | 2016-09-12 11:36:49 -0300 |
---|---|---|
committer | Ansa89 <ansalonistefano@gmail.com> | 2017-04-01 17:47:34 +0200 |
commit | 200ee1cace2f17537e6982ac447ea65d7c7a00b3 (patch) | |
tree | 5c3cdfd8be52b9b621d859eed877c38d88314f08 /toxcore/tox.h | |
parent | 124d9e0446856002d9d19abddae12107345d67bc (diff) |
initial version of tox_loop
Diffstat (limited to 'toxcore/tox.h')
-rw-r--r-- | toxcore/tox.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/toxcore/tox.h b/toxcore/tox.h index 75757b6f..0be019cd 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h | |||
@@ -990,6 +990,42 @@ uint32_t tox_iteration_interval(const Tox *tox); | |||
990 | */ | 990 | */ |
991 | void tox_iterate(Tox *tox, void *user_data); | 991 | void tox_iterate(Tox *tox, void *user_data); |
992 | 992 | ||
993 | /** | ||
994 | * Run tox_iterate() any time a packet arrives, only returns after tox_loop_stop(). | ||
995 | */ | ||
996 | uint32_t tox_loop(Tox *tox, void *user_data); | ||
997 | |||
998 | /** | ||
999 | * Tell tox_loop() to return. | ||
1000 | */ | ||
1001 | void tox_loop_stop(Tox *tox); | ||
1002 | |||
1003 | /** | ||
1004 | * No extra parameters. | ||
1005 | */ | ||
1006 | typedef void tox_loop_begin_cb(Tox *tox, void *user_data); | ||
1007 | |||
1008 | |||
1009 | /** | ||
1010 | * Set the callback for the `loop_begin` event. Pass NULL to unset. | ||
1011 | * | ||
1012 | * Callback ran when tox_loop() calls into tox_iterate(), the client can lock a mutex here. | ||
1013 | */ | ||
1014 | void tox_callback_loop_begin(Tox *tox, tox_loop_begin_cb *callback); | ||
1015 | |||
1016 | /** | ||
1017 | * No extra parameters. | ||
1018 | */ | ||
1019 | typedef void tox_loop_end_cb(Tox *tox, void *user_data); | ||
1020 | |||
1021 | |||
1022 | /** | ||
1023 | * Set the callback for the `loop_end` event. Pass NULL to unset. | ||
1024 | * | ||
1025 | * Callback ran when tox_loop() is finished with tox_iterate(), the client can unlock the mutex here. | ||
1026 | */ | ||
1027 | void tox_callback_loop_end(Tox *tox, tox_loop_end_cb *callback); | ||
1028 | |||
993 | 1029 | ||
994 | /******************************************************************************* | 1030 | /******************************************************************************* |
995 | * | 1031 | * |