Home

Add

Edit

With Linenumbers

Code in Textfield

Download

[code]type test
    foo As Integer
    Declare Sub main()
    Declare Sub thread
End Type

Sub test.thread()
    Do
        This.foo += 1
        Print Timer() & ":" & Str(This.foo)
        Sleep 1000
    Loop
End Sub

Sub test.main()
    threadcall thread()
End Sub

Dim foo As test Ptr = Callocate(Sizeof(test))
foo->main()
Sleep 4000, 1
Deallocate(foo)


Do
    Sleep 1, 1
Loop
'dim bar as sub() 
'bar = foo.thread
[/code]
[pre]tpm@lara:/media/data20_md0/Projekte/freeBASIC/test/test4$ ../../sonstiges/fbc_static/FreeBASIC-0.24.0-linux-staticbin/bin/fbc test4.bas && ./test4
1362174784.144476:1
1362174785.184758:2
1362174786.224755:3
1362174787.263767:4
1362174788.303786:1
1362174789.344021:2
1362174790.383774:3
1362174791.424802:4
1362174792.464761:5
1362174793.504418:6
1362174794.544829:7

tpm@lara:/media/data20_md0/Projekte/freeBASIC/test/test4$       
[/pre]