Changeset 5715d43 for libcfa


Ignore:
Timestamp:
Aug 14, 2020, 1:29:03 PM (4 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
762fbc1
Parents:
4c925cd
Message:

Exceptions now get their context differently with libcfathread. Added a number of tests to help test this.

Location:
libcfa/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/coroutine.cfa

    r4c925cd r5715d43  
    215215                return cor;
    216216        }
     217
     218        struct $coroutine * __cfactx_cor_active(void) {
     219                return active_coroutine();
     220        }
    217221}
    218222
  • libcfa/src/concurrency/invoke.c

    r4c925cd r5715d43  
    2929// Called from the kernel when starting a coroutine or task so must switch back to user mode.
    3030
     31extern struct $coroutine * __cfactx_cor_active(void);
    3132extern struct $coroutine * __cfactx_cor_finish(void);
    3233extern void __cfactx_cor_leave ( struct $coroutine * );
     
    3536extern void disable_interrupts() OPTIONAL_THREAD;
    3637extern void enable_interrupts( __cfaabi_dbg_ctx_param );
     38
     39struct exception_context_t * this_exception_context() {
     40        return &__get_stack( __cfactx_cor_active() )->exception_context;
     41}
    3742
    3843void __cfactx_invoke_coroutine(
  • libcfa/src/concurrency/invoke.h

    r4c925cd r5715d43  
    9898        }
    9999
     100        struct exception_context_t * this_exception_context();
     101
    100102        // struct which calls the monitor is accepting
    101103        struct __waitfor_mask_t {
  • libcfa/src/exception.c

    r4c925cd r5715d43  
    5959
    6060
    61 // Temperary global exception context. Does not work with concurency.
    62 static struct exception_context_t shared_stack = {NULL, NULL};
    63 
    6461// Get the current exception context.
    6562// There can be a single global until multithreading occurs, then each stack
    66 // needs its own. It will have to be updated to handle that.
    67 struct exception_context_t * this_exception_context() {
     63// needs its own. We get this from libcfathreads (no weak attribute).
     64__attribute__((weak)) struct exception_context_t * this_exception_context() {
     65        static struct exception_context_t shared_stack = {NULL, NULL};
    6866        return &shared_stack;
    6967}
Note: See TracChangeset for help on using the changeset viewer.