Home

Add

Edit

Without Linenumbers

Code in Textfield


  1. Type test
    
  2.     foo As Integer
    
  3.     Declare Sub main()
    
  4.     Declare Sub thread
    
  5. End Type
    
  6. 
    
  7. Sub test.thread()
    
  8.     Do
    
  9.         This.foo += 1
    
  10.         Print Timer() & ":" & Str(This.foo)
    
  11.         Sleep 1000
    
  12.     Loop
    
  13. End Sub
    
  14. 
    
  15. Sub test.main()
    
  16.     threadcall thread()
    
  17. End Sub
    
  18. 
    
  19. Dim foo As test Ptr = Callocate(Sizeof(test))
    
  20. foo->main()
    
  21. Sleep 4000, 1
    
  22. Deallocate(foo)
    
  23. 
    
  24. 
    
  25. Do
    
  26.     Sleep 1, 1
    
  27. Loop
    
  28. 'dim bar as sub() 
    
  29. 'bar = foo.thread
    


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$