public class Semaphore : TaskQueue
A high-level non-recursive counting semaphore
This is a semaphore designed for asynchronous GObject programming. It integrates well with the main event loop and provides features such as prioritization, cancellation, and asynchronous interfaces. Requests with higher priorities will always be executed first, and requests of equal priorities will be executed in the order in which they are requested.
Unfortunately, this is relatively slow compared to lower level mutex implementations such as GMutex and pthreads. If you don't require the advanced features, or if you only need short-lived locks, it would probably be much better to use GMutex. However, if you are writing an asynchronous GObject-based application the convenience provided by these methods can go a long way towards helping you write applications don't block the main loop and, therefore, feel faster.