Mercurial > hg > GearsTemplate
view src/parallel_execution/context.h @ 91:1e074c3878c7
modify tree
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 26 Jan 2016 07:46:26 +0900 |
parents | 4b5bf5b40970 |
children | 851da1107223 |
line wrap: on
line source
/* Context definition for llrb example */ #include <pthread.h> #include "stack.h" #define ALLOCATE_SIZE 100000 enum Code { Code1, Code2, Code3, Code4, Code5, Find, Not_find, Code6, Allocator, PutTree, Replace, Insert, Compare, RotateL, RotateR, SetTree, InsertCase1, InsertCase2, InsertCase3, InsertCase4, InsertCase4_1, InsertCase4_2, InsertCase5, StackClear, Get, Search, Delete, Delete1, Delete2, Delete3, Replace_d1, Replace_d2, FindMax1, FindMax2, DeleteCase1, DeleteCase2, DeleteCase3, DeleteCase4, DeleteCase5, DeleteCase6, CreateWorker, TaskManager, CreateData1, CreateData2, CreateTask1, CreateTask2, PutQueue1, PutQueue2, PutQueue3, PutQueue4, GetQueue, Exit, }; enum Relational { EQ, GT, LT, }; enum UniqueData { Worker, Allocate, Tree, Traverse, Node, LoopCounter, Element, ActiveQueue, }; struct Context { enum Code next; int codeNum; __code (**code) (struct Context*); void* heapStart; void* heap; long heapLimit; pthread_t thread; stack_ptr code_stack; stack_ptr node_stack; int dataNum; union Data **data; }; union Data { struct LoopCounter { int i; } loopCounter; struct Worker { int num; struct Context* contexts; } worker; struct Task { enum Code code; int key; } task; struct Queue { struct Element* first; struct Element* last; int count; } queue; struct Element { struct Task* task; struct Element* next; } element; struct Array { int index; int* array; } array; struct Tree { struct Node* root; } tree; struct Traverse { struct Node* current; int result; } traverse; struct Node { // need to tree enum Code next; int key; // comparable data segment union Data* value; struct Node* left; struct Node* right; // need to balancing enum Color { Red, Black, } color; } node; struct Allocate { enum Code next; long size; } allocate; };