Skip to content

Instantly share code, notes, and snippets.

Created April 6, 2017 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/89a26076f71941daf67eb939a8690d42 to your computer and use it in GitHub Desktop.
Save anonymous/89a26076f71941daf67eb939a8690d42 to your computer and use it in GitHub Desktop.
producer consumer
method append(Data d){
[buffer <= max(buffer)]
await (n < max) ;
buffer = appendData(d,buffer);
n = n + 1 ;
}
method remove() {
Data d = 0;
await n > 0 ;
d = dataHead(buffer);
buffer = dataTail(buffer);
n = n - 1 ;
return d ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment