Ignore:
Timestamp:
Jan 20, 2017, 4:50:15 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, 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, resolv-new, with_gc
Children:
207c7e1d
Parents:
dcb42b8
Message:

Kernel now uses intrusive lists and blocking locks for ready queue management.
Update the plan for concurrency.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/examples/thread.c

    rdcb42b8 rbd98b58  
    1010};
    1111
    12 DECL_THREAD(MyThread)
     12// DECL_THREAD(MyThread)
    1313
    1414void ?{}( MyThread * this, unsigned id, unsigned count ) {
     
    1717}
    1818
    19 void main(MyThread* this) {
    20         sout | "Thread" | this->id | " : Suspending" | this->count | "times" | endl;
    21         suspend();
     19// void main(MyThread* this) {
     20//      sout | "Thread" | this->id | " : Suspending" | this->count | "times" | endl;
     21//      yield();
    2222
    23         for(int i = 0; i < this->count; i++) {
    24                 sout | "Thread" | this->id | " : Suspend No." | i + 1 | endl;
    25                 suspend();
    26         }
    27 }
     23//      for(int i = 0; i < this->count; i++) {
     24//              sout | "Thread" | this->id | " : Suspend No." | i + 1 | endl;
     25//              yield();
     26//      }
     27// }
    2828
    2929int main(int argc, char* argv[]) {
    3030
    31         unsigned itterations = 10u;
    32         if(argc == 2) {
    33                 int val = ato(argv[1]);
    34                 assert(val >= 0);
    35                 itterations = val;
    36         }
     31        // unsigned itterations = 10u;
     32        // if(argc == 2) {
     33        //      int val = ato(argv[1]);
     34        //      assert(val >= 0);
     35        //      itterations = val;
     36        // }
    3737
    3838        sout | "User main begin" | endl;
    3939
    40         {
    41                 thread(MyThread) thread1 = { 1u, itterations };
    42                 thread(MyThread) thread2 = { 2u, itterations };
    43         }
     40        // {
     41        //      thread(MyThread) thread1 = { 1u, itterations };
     42        //      thread(MyThread) thread2 = { 2u, itterations };
     43        // }
    4444
    4545        sout | "User main end" | endl;
Note: See TracChangeset for help on using the changeset viewer.