Small Basic - Synchronous and Asynchronous Type Operations

The challenge of this month has Multitasking Challenge.  In Small Basic, there are two types of operations.  One is synchronous type, the other is asynchronous type.  Most of operations are synchronous type that wait the operations done before starting the next step.  But some operations are asynchronous type that don't wait the operations done.

Asynchronous Type Operations

Following operations are asynchronous type:

  • Shape.Animation()
  • Sound.Play()
  • Sound.PlayBellRing()
  • Sound.PlayChime()
  • Sound.PlayChimes()
  • Sound.PlayClick()

Synchronous Type Operations

Other operations than listed above are synchronous type.  Especially, following operations may need much time.

  • File.ReadContents()
  • Flickr.GetRandomPicture()
  • ImageList.LoadImage()
  • Network.GetWebPageContents()
  • Sound.PlayMusic()
  • Turtle.Move()

If you want to do something while running synchronous type operations, you should use events such as timer, mouse, keyboard or controls events.  On the other side, be careful to use these slow asynchronous type operations in an event handler subroutine.  The next event will occur while running the last event handler.