Changeset 815 for pjproject/trunk/pjlib/src/pj/os_core_unix.c
- Timestamp:
- Nov 21, 2006 12:39:31 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/os_core_unix.c
r750 r815 148 148 pj_generate_unique_string( &guid ); 149 149 150 /* Initialize exception ID for the pool.151 * Must do so after critical section is configured.152 */153 rc = pj_exception_id_alloc("PJLIB/No memory", &PJ_NO_MEMORY_EXCEPTION);154 if (rc != PJ_SUCCESS)155 return rc;156 157 150 /* Startup timestamp */ 158 151 #if defined(PJ_HAS_HIGH_RES_TIMER) && PJ_HAS_HIGH_RES_TIMER != 0 … … 170 163 return PJ_SUCCESS; 171 164 } 165 166 /* 167 * pj_atexit() 168 */ 169 PJ_DEF(pj_status_t) pj_atexit(void (*func)(void)) 170 { 171 if (atexit_count >= PJ_ARRAY_SIZE(atexit_func)) 172 return PJ_ETOOMANY; 173 174 atexit_func[atexit_count++] = func; 175 return PJ_SUCCESS; 176 } 177 178 /* 179 * pj_shutdown(void) 180 */ 181 PJ_DEF(void) pj_shutdown() 182 { 183 int i; 184 185 /* Call atexit() functions */ 186 for (i=atexit_count-1; i>=0; --i) { 187 (*atexit_func[i])(); 188 } 189 atexit_count = 0; 190 191 /* Free exception ID */ 192 if (PJ_NO_MEMORY_EXCEPTION != -1) { 193 pj_exception_id_free(PJ_NO_MEMORY_EXCEPTION); 194 PJ_NO_MEMORY_EXCEPTION = -1; 195 } 196 197 #if PJ_HAS_THREADS 198 /* Destroy PJLIB critical section */ 199 pj_mutex_destroy(&critical_section); 200 201 /* Free PJLIB TLS */ 202 if (thread_tls_id != -1) { 203 pj_thread_local_free(thread_tls_id); 204 thread_tls_id = -1; 205 } 206 #endif 207 } 208 172 209 173 210 /*
Note: See TracChangeset
for help on using the changeset viewer.