Chapter 18Multithreading

  • Worker threads
  • Using mutexes and monitors
  • Timers
  • Event-driven threads
  • Inter-thread communication

The wrox.com code downloads for this chapter are found at www.wrox.com/go/professionaltizen on the Download Code tab. After decompressing the downloaded zip file you will have a tizen-multithread directory that contains the finished application.

This chapter explains how to write a multithreaded application.

From time to time, an application task requires a lengthy operation. If you try to perform this task in the same thread that handles the user interface, your UI may be blocked and your application may become unresponsive to the user. All readers are likely familiar with the notorious spinning hourglass or circle in Windows or the spinning beach ball in Mac OS X.

To prevent this problem from occurring, you can delegate a lengthy operation to another thread, enabling your complex processing to continue while your application remains responsive. Tizen includes native APIs for multithread programming in the Tizen::Base::Runtime namespace, the main classes of which are Thread, Mutex, and Event. The Thread class represents the concept of a separate thread of control; Mutex is a basic synchronisation primitive between Threads; and Event represents a multicast event channel between Threads.

The chapter includes code that shows you how to make use of these classes, and advanced topics such as ...

Get Professional Tizen Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.