123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- #include <stdlib.h>
- #include "pthread.h"
- #include "implement.h"
- void
- pte_throw (unsigned int exception)
- {
-
- pte_thread_t * sp = (pte_thread_t *) pthread_getspecific (pte_selfThreadKey);
- if (exception != PTE_EPS_CANCEL && exception != PTE_EPS_EXIT)
- {
-
- exit (1);
- }
- if (NULL == sp || sp->implicit)
- {
-
- unsigned exitCode = 0;
- switch (exception)
- {
- case PTE_EPS_CANCEL:
- exitCode = (unsigned) PTHREAD_CANCELED;
- break;
- case PTE_EPS_EXIT:
- exitCode = (unsigned) sp->exitStatus;;
- break;
- }
- pte_thread_detach_and_exit_np ();
- }
- #ifdef PTE_CLEANUP_C
- pte_pop_cleanup_all (1);
- longjmp (sp->start_mark, exception);
- #else
- #ifdef PTE_CLEANUP_CXX
- switch (exception)
- {
- case PTE_EPS_CANCEL:
- throw pte_exception_cancel ();
- break;
- case PTE_EPS_EXIT:
- throw pte_exception_exit ();
- break;
- }
- #else
- #error ERROR [__FILE__, line __LINE__]: Cleanup type undefined.
- #endif
- #endif
-
- }
- void
- pte_pop_cleanup_all (int execute)
- {
- while (NULL != pte_pop_cleanup (execute))
- {
- }
- }
- unsigned int
- pte_get_exception_services_code (void)
- {
- return (unsigned int) NULL;
- }
|