msDebugCleanup() ** ** Called by msCleanup to remove info related to this thread. */
| 302 | ** Called by msCleanup to remove info related to this thread. |
| 303 | */ |
| 304 | void msDebugCleanup() |
| 305 | { |
| 306 | /* make sure file is closed */ |
| 307 | msCloseErrorFile(); |
| 308 | |
| 309 | #ifdef USE_THREAD |
| 310 | { |
| 311 | int thread_id = msGetThreadId(); |
| 312 | debugInfoObj *link; |
| 313 | |
| 314 | msAcquireLock( TLOCK_DEBUGOBJ ); |
| 315 | |
| 316 | /* find link for this thread */ |
| 317 | |
| 318 | for( link = debuginfo_list; |
| 319 | link != NULL && link->thread_id != thread_id |
| 320 | && link->next != NULL && link->next->thread_id != thread_id; |
| 321 | link = link->next ) {} |
| 322 | |
| 323 | if( link->thread_id == thread_id ) |
| 324 | { |
| 325 | /* presumably link is at head of list. */ |
| 326 | if( debuginfo_list == link ) |
| 327 | debuginfo_list = link->next; |
| 328 | |
| 329 | free( link ); |
| 330 | } |
| 331 | else if( link->next != NULL && link->next->thread_id == thread_id ) |
| 332 | { |
| 333 | debugInfoObj *next_link = link->next; |
| 334 | link->next = link->next->next; |
| 335 | free( next_link ); |
| 336 | } |
| 337 | msReleaseLock( TLOCK_DEBUGOBJ ); |
| 338 | } |
| 339 | #endif |
| 340 | |
| 341 | } |
| 342 | |
| 343 | /* msDebug() |
| 344 | ** |
no test coverage detected