Mercurial > hg > GearsTemplate
diff src/parallel_execution/examples/boundedBuffer/BoundedBuffer.cbc @ 507:a7127917c736
SemaphoreImpl use spinlock
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 03 Jan 2018 17:34:14 +0900 |
parents | 2e7ea81e5943 |
children | bc1616e1e172 |
line wrap: on
line diff
--- a/src/parallel_execution/examples/boundedBuffer/BoundedBuffer.cbc Tue Jan 02 06:16:40 2018 +0900 +++ b/src/parallel_execution/examples/boundedBuffer/BoundedBuffer.cbc Wed Jan 03 17:34:14 2018 +0900 @@ -18,13 +18,13 @@ } __code putBoundedBuffer(struct BoundedBuffer* buffer, union Data* data, __code next(...)) { - struct Semaphore* sem = buffer->emptyCount; - goto sem->p(putBoundedBuffer1); + struct Semaphore* semaphore = buffer->emptyCount; + goto semaphore->p(putBoundedBuffer1); } __code putBoundedBuffer1(struct BoundedBuffer* buffer, union Data* data, __code next(...)) { - struct Semaphore* sem = buffer->lock; - goto sem->p(putBoundedBuffer2); + struct Semaphore* semaphore = buffer->lock; + goto semaphore->p(putBoundedBuffer2); } __code putBoundedBuffer2(struct BoundedBuffer* buffer, union Data* data, __code next(...)) { @@ -34,26 +34,26 @@ struct Element* last = buffer->last; last->next = element; buffer->last = element; - struct Semaphore* sem = buffer->lock; - goto sem->v(putBoundedBuffer3); + struct Semaphore* semaphore = buffer->lock; + goto semaphore->v(putBoundedBuffer3); } __code putBoundedBuffer3(struct BoundedBuffer* buffer, union Data* data, __code next(...)) { - struct Semaphore* sem = buffer->fullCount; - goto sem->v(putBoundedBuffer4); + struct Semaphore* semaphore = buffer->fullCount; + goto semaphore->v(putBoundedBuffer4); } __code putBoundedBuffer4(struct BoundedBuffer* buffer, union Data* data, __code next(...)) { goto next(...); } __code takeBoundedBuffer(struct BoundedBuffer* buffer, __code next(union Data* data, ...)) { - struct Semaphore* sem = buffer->fullCount; - goto sem->p(takeBoundedBuffer1); + struct Semaphore* semaphore = buffer->fullCount; + goto semaphore->p(takeBoundedBuffer1); } __code takeBoundedBuffer1(struct BoundedBuffer* buffer, __code next(union Data* data, ...)) { - struct Semaphore* sem = buffer->lock; - goto sem->p(takeBoundedBuffer2); + struct Semaphore* semaphore = buffer->lock; + goto semaphore->p(takeBoundedBuffer2); } __code takeBoundedBuffer2(struct BoundedBuffer* buffer, __code next(union Data* data, ...)) { @@ -62,13 +62,13 @@ data = nextElement->data; *O_data =data; buffer->top = nextElement; - struct Semaphore* sem = buffer->lock; - goto sem->v(takeBoundedBuffer3); + struct Semaphore* semaphore = buffer->lock; + goto semaphore->v(takeBoundedBuffer3); } __code takeBoundedBuffer3(struct BoundedBuffer* buffer, __code next(union Data* data, ...)) { - struct Semaphore* sem = buffer->emptyCount; - goto sem->v(takeBoundedBuffer4); + struct Semaphore* semaphore = buffer->emptyCount; + goto semaphore->v(takeBoundedBuffer4); } __code takeBoundedBuffer4(struct BoundedBuffer* buffer, __code next(union Data* data, ...)) {