12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include "pthread.h"
- #include "implement.h"
- 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;
- }
- }
|