All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gopher.impl.SPSCBuffer.scala Maven / Gradle / Ivy

Go to download

scala-gopher: asynchronous implementation of CSP ( go-like channels/selectors ) in scala

The newest version!
package gopher.impl

import gopher._

/**
* Buffer.  access to buffer is exclusive by owner channel, 
* different loops can start in different threads but only one loop can be active at the samw time
**/
trait SPSCBuffer[A] {

   def isEmpty(): Boolean
  
   def startRead(): A
   def finishRead(): Boolean
  
   def isFull(): Boolean
   // prcondition: !isFull()
   def write(a: A): Boolean 


   // set local state from published
   def local(): Unit 

   // make buffer be readable from other thread than
   def publish(): Unit
   
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy