Language Qore
(SMP threaded scripting language)
Date: | 07/11/12 |
Author: | Brett Estrade |
URL: | n/a |
Comments: | 0 |
Info: | http://www.qore.org |
Score: | (1.50 in 2 votes) |
#!/usr/bin/env qore %require-our %enable-all-warnings %require-types # make sure we have the right version of qore %requires qore >= 0.8.3 # no gui %no-gui # global variables (truly shared among threads) must be declared with "our" keyword %require-our our Counter $count(); sub t() { on_exit { $count.dec(); } my int $i = gettid()-1; printf("%d bottles of beer on the wall\n", $i); printf("%d bottles of beer\n", $i); printf("take one down, pass it around\n"); printf("%d bottles of beer on the wall\n", $i); } #-- following run by main thread for (my int $i = 99; $i > 0; $i--) { $count.inc(); background t(); } $count.waitForZero();
Download Source | Write Comment
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments