Chapter 5. Programming hints

  • Except if what you are doing is trivial, try not to use the sync* functions. They are less efficient than the asynchronous ones.

  • The callback functions should return as fast as possible, since all callbacks are called by the same thread. If you have time-consuming operations, you should spawn an other thread and use synchronisation mechanisms such as semaphores or mutexes.