QuickIO  0.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions
job.h File Reference

Provides a simple interface for running jobs in multiple threads at once. More...

#include "qev.h"

Go to the source code of this file.

Functions

void qev_job (qev_data_cb cb, void **data, guint datac)
 Runs the given jobs in the pool, only returning once all jobs have completed. More...
 
void * qev_job_async (qev_data_cb cb, void **data, guint datac, gboolean joinable)
 Asynchronously runs the job in the pool. More...
 
void qev_job_async_join (void *job)
 Wait for the async job to complete. More...
 

Detailed Description

Provides a simple interface for running jobs in multiple threads at once.

Each thread that runs a job has access to QEV's thread-local resources.

Author
Andrew Stone andre.nosp@m.w@cl.nosp@m.ovar..nosp@m.com

Function Documentation

void qev_job ( qev_data_cb  cb,
void **  data,
guint  datac 
)

Runs the given jobs in the pool, only returning once all jobs have completed.

Parameters
cbThe callback to run from each thread
dataThe data to be passed to the threads. Each pointer, 1...N, will be passed to its respective thread. [transfer-none]
datacThe number of data elements that need to be worked on
void* qev_job_async ( qev_data_cb  cb,
void **  data,
guint  datac,
gboolean  joinable 
)

Asynchronously runs the job in the pool.

Parameters
cbThe callback to run from each thread
dataThe data to be passed to the threads. Each pointer, 1...N, will be passed to its respective thread. [transfer-none]
datacThe number of data elements that need to be worked on
joinableIf you wish to be able to wait for the job to finish
Returns
If joinable, then this is the pointer to pass to qev_job_async_join() to wait for the job to complete (if a job is joinable and you don't call _qev_job_async_join(), that's a memory leak). [transfer-full]
void qev_job_async_join ( void *  job)

Wait for the async job to complete.

Parameters
jobThe job that needs to complete.