Ignore:
Timestamp:
Jul 18, 2017, 4:35:52 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
f19339e
Parents:
795d450
Message:

Convert more library files to use references

File:
1 edited

Legend:

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

    r795d450 r242a902  
    4343//-----------------------------------------------------------------------------
    4444// Coroutine ctors and dtors
    45 void ?{}(coStack_t* this) {
    46         this->size              = 65000;        // size of stack
    47         this->storage   = NULL; // pointer to stack
    48         this->limit             = NULL; // stack grows towards stack limit
    49         this->base              = NULL; // base of stack
    50         this->context   = NULL; // address of cfa_context_t
    51         this->top               = NULL; // address of top of storage
    52         this->userStack = false;
     45void ?{}(coStack_t& this) {
     46        this.size               = 65000;        // size of stack
     47        this.storage    = NULL; // pointer to stack
     48        this.limit              = NULL; // stack grows towards stack limit
     49        this.base               = NULL; // base of stack
     50        this.context    = NULL; // address of cfa_context_t
     51        this.top                = NULL; // address of top of storage
     52        this.userStack  = false;
    5353}
    5454
    55 void ?{}(coStack_t* this, size_t size) {
     55void ?{}(coStack_t& this, size_t size) {
    5656        this{};
    57         this->size = size;
     57        this.size = size;
    5858
    59         create_stack(this, this->size);
     59        create_stack(&this, this.size);
    6060}
    6161
    62 void ?{}(coroutine_desc* this) {
     62void ?{}(coroutine_desc& this) {
    6363        this{ "Anonymous Coroutine" };
    6464}
    6565
    66 void ?{}(coroutine_desc* this, const char * name) {
    67         this->name = name;
    68         this->errno_ = 0;
    69         this->state = Start;
    70         this->starter = NULL;
    71         this->last = NULL;
     66void ?{}(coroutine_desc& this, const char * name) {
     67        this.name = name;
     68        this.errno_ = 0;
     69        this.state = Start;
     70        this.starter = NULL;
     71        this.last = NULL;
    7272}
    7373
    74 void ?{}(coroutine_desc* this, size_t size) {
     74void ?{}(coroutine_desc& this, size_t size) {
    7575        this{};
    76         (&this->stack){size};
     76        (this.stack){size};
    7777}
    7878
    79 void ^?{}(coStack_t* this) {
     79void ^?{}(coStack_t& this) {
    8080        if ( ! this->userStack ) {
    8181                LIB_DEBUG_DO(
    82                         if ( mprotect( this->storage, pageSize, PROT_READ | PROT_WRITE ) == -1 ) {
    83                                 abortf( "(coStack_t *)%p.^?{}() : internal error, mprotect failure, error(%d) %s.", this, errno, strerror( errno ) );
     82                        if ( mprotect( this.storage, pageSize, PROT_READ | PROT_WRITE ) == -1 ) {
     83                                abortf( "(coStack_t *)%p.^?{}() : internal error, mprotect failure, error(%d) %s.", &this, errno, strerror( errno ) );
    8484                        }
    8585                );
    86                 free( this->storage );
     86                free( this.storage );
    8787        }
    8888}
    8989
    90 void ^?{}(coroutine_desc* this) {}
     90void ^?{}(coroutine_desc& this) {}
    9191
    9292// Part of the Public API
Note: See TracChangeset for help on using the changeset viewer.