Monado OpenXR Runtime
u_worker.c File Reference

Simple worker pool. More...

#include "os/os_threading.h"
#include "util/u_logging.h"
#include "util/u_worker.h"
#include "util/u_trace_marker.h"
Include dependency graph for u_worker.c:

Data Structures

struct  task
 
struct  thread
 
struct  pool
 
struct  group
 

Macros

#define MAX_TASK_COUNT   (64)
 
#define MAX_THREAD_COUNT   (16)
 

Functions

static struct groupgroup (struct u_worker_group *uwg)
 
static struct poolpool (struct u_worker_thread_pool *uwtp)
 
static void locked_pool_pop_task (struct pool *p, struct task *out_task)
 
static void locked_pool_push_task (struct pool *p, struct group *g, u_worker_group_func_t func, void *data)
 
static void locked_pool_wake_worker_if_allowed (struct pool *p)
 
static bool locked_group_should_enter_wait_loop (struct pool *p, struct group *g)
 
static bool locked_group_should_wait (struct pool *p, struct group *g)
 
static void locked_group_wake_waiter_if_allowed (struct pool *p, struct group *g)
 
static void locked_group_wait (struct pool *p, struct group *g)
 
static bool locked_thread_allowed_to_work (struct pool *p)
 
static void locked_thread_wait_for_work (struct pool *p)
 
static void * run_func (void *ptr)
 
struct u_worker_thread_poolu_worker_thread_pool_create (uint32_t starting_worker_count, uint32_t thread_count, const char *prefix)
 Creates a new thread pool to be used by a worker group. More...
 
void u_worker_thread_pool_destroy (struct u_worker_thread_pool *uwtp)
 Internal function, only called by reference. More...
 
struct u_worker_groupu_worker_group_create (struct u_worker_thread_pool *uwtp)
 Create a new worker group. More...
 
void u_worker_group_push (struct u_worker_group *uwg, u_worker_group_func_t f, void *data)
 Push a new task to worker group. More...
 
void u_worker_group_wait_all (struct u_worker_group *uwg)
 Wait for all pushed tasks to be completed, "donates" this thread to the shared thread pool. More...
 
void u_worker_group_destroy (struct u_worker_group *uwg)
 Destroy a worker pool. More...
 

Detailed Description

Simple worker pool.

Author
Jakob Bornecrantz jakob.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m

Function Documentation

◆ locked_pool_wake_worker_if_allowed()

static void locked_pool_wake_worker_if_allowed ( struct pool p)
static