#1466 closed enhancement (fixed)
Allow to use PJLIB API without PJSUA-LIB API
Reported by: | bennylp | Owned by: | bennylp |
---|---|---|---|
Priority: | normal | Milestone: | release-1.14 |
Component: | common | Version: | common |
Keywords: | Cc: | ||
Backport to 1.x milestone: | Backported: |
Description
Some application wants to be able to use PJLIB before pjsua_create() and after pjsua_destroy() is called, or to continue using PJLIB objects while PJSUA-LIB is being restarted. This was not possible because when application is utilizing PJSUA-LIB, the PJLIB library is initialized in pjsua_create() and shutdown in pjsua_destroy().
The solution that this ticket implements is to allow pj_init() and pj_shutdown() to be called multiple times, and PJLIB should use internal reference counting to determine when it needs to actually be initialized or shutdown. Hence if application wants to use PJLIB before pjsua_create(), it should call pj_init() manually beforehand, and call pj_shutdown() when it's finished with using PJLIB.
Note that there MUST be equal number of calls to pj_shutdown() for every call to pj_init(), or otherwise PJLIB won't get shutdown!
Also note that this solution calls for moving some pj_atexit() use in higher library layers into a new equivalent functionality. This task will be implemented by this ticket too.
Change History (2)
comment:1 Changed 13 years ago by nanang
- Resolution set to fixed
- Status changed from new to closed
(In [3986]) Close #1466 (using PJLIB outside PJSUA-LIB context):