Skip to content

English manual

Shuta Kimura edited this page Oct 7, 2018 · 6 revisions

TinyThreads wiki (English)

'TinyThreads' is a library which provides multi-threading environment with POSIX thread (pthread) compatible APIs for embedded boards with 32-bit microcontrollers. You can easily build a multi-threaded environment under limited ROM/RAM sizes.

  • Pros
    • Because it conforms to POSIX thread API, you don't need to learn new API.
    • Because it is designed to be integrated with IDE of each CPU, you can easily apply to your projects.
  • Cons
    • The kinds and functions of synchronization object is less than other RTOSs. (It is a constraint to making API to be POSIX compliant)
      • For example, there is no equivalent to event flags which can be handled in interrupt handlers.

License

TinyThreads is distributed under the MIT License.

Supported processors

Currently, following processors are supported.

Supported features

  • Multi-thread control by time-slicing on single core processor.
  • Scheduling based on priority and policy (Round-robin or FIFO) of each thread.
  • Force thread switching by preemption.
  • Dynamic thread creation and termination (pthread_create / pthread_exit)
  • Waiting for threads' temination (pthread_join)
  • Mutex (pthread_mutex_*)
  • Conditional variables (pthread_cond_*)
  • Once control (pthread_once_*)
  • Semaphore (sem_*)
    • sem_post is a only function which can be used safely in interrupt handlers.
  • Sleep functions (sleep, usleep)
    • Not Pthreads API, but TinyThreads scheduler can provide efficient sleep functionality.
  • Thread name (pthread_getname_np / pthread_setname_np)
    • Not POSIX standards, but these functions may help you in debugging.

See API List for details.

Features not yet supported

  • Barrier (pthread_barrier_*)
  • Spin lock (pthread_spin_*)
  • Reader-writer lock (pthread_rwlock_*)

Dropped features

The following functions are not supported. They are judged unnecessary under the embedded environment, and there is no plan to support in the feature.

  • TLS (Thread Local Storage) (pthread_key_* etc.)
  • Canceling (pthread_cancel etc.)
  • Signal functions (pthread_sig*)