Changeset 815 for pjproject/trunk/pjlib/src/pj/os_core_win32.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_win32.c
r746 r815 109 109 */ 110 110 static pj_thread_desc main_thread; 111 static long thread_tls_id ;111 static long thread_tls_id = -1; 112 112 static pj_mutex_t critical_section_mutex; 113 113 static unsigned atexit_count; 114 static void (*atexit_func[32])(void); 114 115 115 116 /* … … 178 179 179 180 /* 181 * pj_atexit() 182 */ 183 PJ_DEF(pj_status_t) pj_atexit(void (*func)(void)) 184 { 185 if (atexit_count >= PJ_ARRAY_SIZE(atexit_func)) 186 return PJ_ETOOMANY; 187 188 atexit_func[atexit_count++] = func; 189 return PJ_SUCCESS; 190 } 191 192 193 /* 194 * pj_shutdown(void) 195 */ 196 PJ_DEF(void) pj_shutdown() 197 { 198 int i; 199 200 /* Call atexit() functions */ 201 for (i=atexit_count-1; i>=0; --i) { 202 (*atexit_func[i])(); 203 } 204 atexit_count = 0; 205 206 /* Free exception ID */ 207 if (PJ_NO_MEMORY_EXCEPTION != -1) { 208 pj_exception_id_free(PJ_NO_MEMORY_EXCEPTION); 209 PJ_NO_MEMORY_EXCEPTION = -1; 210 } 211 212 /* Destroy PJLIB critical section */ 213 pj_mutex_destroy(&critical_section_mutex); 214 215 /* Free PJLIB TLS */ 216 if (thread_tls_id != -1) { 217 pj_thread_local_free(thread_tls_id); 218 thread_tls_id = -1; 219 } 220 221 /* Shutdown Winsock */ 222 WSACleanup(); 223 } 224 225 226 /* 180 227 * pj_getpid(void) 181 228 */
Note: See TracChangeset
for help on using the changeset viewer.