Mercurial > hg > Gears > GearsAgda
view src/synchronizedQueue/synchronizedQueueContext.h @ 58:4283b87ddbf4
Add stub to synchronizedQueues
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 16 Jun 2015 15:59:48 +0900 |
parents | 83ee9c75115a |
children | 2a40d697bf4e |
line wrap: on
line source
/* Context definition for synchronized queue example */ #include <pthread.h> #define ALLOCATE_SIZE 1000 enum Code { Code1, Code2, Code3, Code4, Code5, Code6, Code7, Allocator, Sender, Put, Receiver, Get, Exit, ThreadExit, }; enum UniqueData { Allocate, Queue, Counter, }; struct Context { int codeNum; __code (**code) (struct Context *); void* heap_start; void* heap; long dataSize; int dataNum; union Data* head; union Data** data; }; union Data { long count; struct Queue { struct Element* first; struct Element* last; int count; pthread_mutex_t mutex; pthread_cond_t cond; } queue; struct Element { int value; struct Element* next; } element; struct Allocate { long size; enum Code next; enum Code after_put; enum Code after_get; enum Code after_fail; } allocate; };