Add lwevent_exit()

This commit is contained in:
Laurence Withers 2007-10-27 17:43:14 +00:00
parent c7663cc4a2
commit 51e14f327f
2 changed files with 25 additions and 0 deletions

View File

@ -71,6 +71,18 @@ int lwevent_init(void)
/* lwevent_exit()
* Cleans up resources used by lwevent, putting the library into a state where it is ready to be
* re-initialised with lwevent_init().
*/
void lwevent_exit(void)
{
close(lwevent_epoll_fd);
free(_lw_revents);
}
/* lwevent_loop() /* lwevent_loop()
* Convenience function which just keeps calling lwevent_wait(), with no timeout, until an error * Convenience function which just keeps calling lwevent_wait(), with no timeout, until an error
* occurs or lwevent_loop_exit is set. * occurs or lwevent_loop_exit is set.

View File

@ -32,6 +32,19 @@ int lwevent_init(void);
/*! \brief Shut down library.
Cleans up the library, closing the epoll file descriptor and freeing any memory used. Does not
free any of the memory associated with <code>struct lwevent</code> objects. If the library were to
be reinitialised, any objects that persisted could be activated on the new epoll file descriptor
with lwevent_reactivate(). Otherwise, such objects can be freed (even after exiting) with
lwevent_free().
*/
void lwevent_exit(void);
/*! \brief Event loop exit flag. /*! \brief Event loop exit flag.
This flag, if set, signifies that lwevent_loop() should exit after its next iteration. It can be This flag, if set, signifies that lwevent_loop() should exit after its next iteration. It can be