How To Threads
Print Hello World
Write Basic Syntax
Use Properties
Make An If Else Ladder
Make A Branch Statement
Declare Inits
Use Lists
Use Arrays
Make A Class Hierarchy
Use Nil And Nilable Types
Use Dynamic Typing
Declare Variable Number Of Args
Read And Write Files
Check Inheritance And Implementation
Customize Object Equality
Pass References To Methods
Translate Pseudo Code To Cobra 1
Translate Pseudo Code To Cobra 2
Implement IEnumerable 1
Implement IEnumerable 2
Iterate Through Recursive Data With Yield
Make A Collection Class
Declare Contracts
Threads
Win Forms
WPF
GTK
Qyoto
Access MySQL
XNA
Open TK
 
"""
A simple example of creating threads.

Note the use 'ref' to refer to a method instead of invoking it.
"""

use System.Threading


class ThreadExample

    var _maxSeconds = 1.2f
    var _start as DateTime

    def run
        _start = DateTime.now
        t = Thread(ref .writeB)
        t.start
        while not .isFinished
            print 'a' stop
        t.join
        print
        print 'Finished.'
        
    def writeB
        while not .isFinished
            print 'b' stop

    get isFinished as bool
        return DateTime.now.subtract(_start).totalSeconds >= _maxSeconds

    def main is shared
        ThreadExample().run