1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- #include <stdio.h>
- #include <stdlib.h>
- #include "pthread.h"
- #include "implement.h"
- __attribute__((section(".preinit_array"))) typeof(pthread_init) *__pthread_init = pthread_init;
- void pthread_init(void)
- {
- if (pte_processInitialized)
- {
-
- return;
- }
- pte_processInitialized = PTE_TRUE;
-
- pte_osInit();
-
- if ((pthread_key_create (&pte_selfThreadKey, NULL) != 0) ||
- (pthread_key_create (&pte_cleanupKey, NULL) != 0))
- {
- pthread_terminate();
- }
-
- pte_osMutexCreate (&pte_thread_reuse_lock);
- pte_osMutexCreate (&pte_mutex_test_init_lock);
- pte_osMutexCreate (&pte_cond_list_lock);
- pte_osMutexCreate (&pte_cond_test_init_lock);
- pte_osMutexCreate (&pte_rwlock_test_init_lock);
- pte_osMutexCreate (&pte_spinlock_test_init_lock);
- return;
- }
|