Skip to content

Instantly share code, notes, and snippets.

@sourcevault
Created September 6, 2018 02:51
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 sourcevault/0df18b397417539ed30c505daba47928 to your computer and use it in GitHub Desktop.
Save sourcevault/0df18b397417539ed30c505daba47928 to your computer and use it in GitHub Desktop.
copas = require 'copas'
copas.addthread ->
copas.sleep 1
os.execute '<<blocking more than 1 second>>'
I = 0
copas.addthread ->
while true
copas.sleep 0.1
print "I -> #{I}"
I += 1
copas.loop!
@sourcevault
Copy link
Author

@Tieske

output :

I -> 0
I -> 1
I -> 2
<<blocking for 1 second>>
I -> 3
I -> 4
I -> 5

Is there a way to make Copas non-blocking ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment