123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include "pthread.h"
- #include "implement.h"
- __attribute__((section(".fini_array"))) typeof(pthread_terminate) *__pthread_terminate = pthread_terminate;
- void pthread_terminate(void)
- {
- if (pte_processInitialized)
- {
- pte_thread_t * tp, * tpNext;
- if (pte_selfThreadKey != NULL)
- {
-
- pthread_key_delete (pte_selfThreadKey);
- pte_selfThreadKey = NULL;
- }
- if (pte_cleanupKey != NULL)
- {
-
- pthread_key_delete (pte_cleanupKey);
- pte_cleanupKey = NULL;
- }
- pte_osMutexLock (pte_thread_reuse_lock);
- tp = pte_threadReuseTop;
- while (tp != PTE_THREAD_REUSE_EMPTY)
- {
- tpNext = tp->prevReuse;
- free (tp);
- tp = tpNext;
- }
- pte_osMutexUnlock(pte_thread_reuse_lock);
- pte_processInitialized = PTE_FALSE;
- }
- }
|