Next: , Previous: Limitations, Up: Top


6 Memory Model and Thread Safety

liblistserv is reentrant library. You can use it in threads, if each thread calls its own listserv_init and listserv_destroy.

liblistserv frees all the memory allocated by it, the latest when liblistserv_destroy is called.

You can use the returned value of a liblistserv funcion until another listserv function is called. More concrete, the returned value of...

listserv_getsubscriber
listserv_getsubscriebrs
listserv_getsubscriptions
is freed at the next call of one of these functions or listserv_getsieve_scripts.
listserv_content_filter
is valid until subsequent call of the same function or listserv_getsieve_scripts.
listserv_getowned_lists
is valid until listserv_destroy is called.
listserv_getsieve_scripts
is valid until subsequent call of the same function.
listserv_command
is destroyed upon the next call of any listserv function.
listserv_getlist_keyword
is valid until subsequent call of the same function over another list or listserv_getsieve_scripts.

Example:

              char **owners = listserv_getlist_keyword (l, "ABC-L", "Owner");
              char **notebook = listserv_getlist_keyword (l, "ABC-L", "Notebook");
              //at this time owners[0], owners[1]... are valid and contain the listowners of ABC-L
              char **sizelim = listserv_getlist_keyword (l, "DEF-L", "SizeLim");
              //here the values pointed by owners and notebook are invalid