| Iris Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#define IRIS_TYPE_THREAD IrisThread; IrisThreadWork; GType iris_thread_get_type (void); IrisThread* iris_thread_new (gboolean exclusive); IrisThread* iris_thread_get (void); void iris_thread_manage (IrisThread *thread, IrisQueue *queue, gboolean leader); void iris_thread_shutdown (IrisThread *thread); void iris_thread_print_stat (IrisThread *thread); IrisThreadWork* iris_thread_work_new (IrisCallback callback, gpointer data); void iris_thread_work_free (IrisThreadWork *thread_work); void iris_thread_work_run (IrisThreadWork *thread_work);
IrisThread provides an abstraction upon the underlying threading system for use by IrisScheduler implementations.
typedef struct {
gpointer user_data;
gpointer user_data2;
gpointer user_data3;
} IrisThread;
typedef struct {
IrisCallback callback;
gpointer data;
gboolean taken;
} IrisThreadWork;
IrisThread* iris_thread_new (gboolean exclusive);
Createa a new IrisThread instance that can be used to queue work items to be processed on the thread.
If exclusive, then the thread will not yield to the scheduler and
therefore will not participate in scheduler thread balancing.
|
the thread is exclusive |
Returns : |
the newly created IrisThread instance |
IrisThread* iris_thread_get (void);
Retrieves the pointer to the current threads structure.
Returns : |
the threads structure or NULL if not an IrisThread. |
void iris_thread_manage (IrisThread *thread, IrisQueue *queue, gboolean leader);
Sends a message to the thread asking it to retreive work items from the queue.
If leader is TRUE, then the thread will periodically ask the scheduler
manager to ask for more threads.
|
An IrisThread |
|
A GAsyncQueue |
|
If the thread is responsible for asking for more threads |
void iris_thread_shutdown (IrisThread *thread);
Sends a message to the thread asking it to shutdown.
|
An IrisThread |
void iris_thread_print_stat (IrisThread *thread);
Prints the stats of an IrisThread to standard output for analysis.
See iris_thread_stat() for programmatically access the statistics.
|
An IrisThread |
IrisThreadWork* iris_thread_work_new (IrisCallback callback, gpointer data);
Creates a new instance of IrisThreadWork, which is the negotiated contract between schedulers and the thread workers themselves.
|
An IrisCallback |
|
user supplied data |
Returns : |
The newly created IrisThreadWork instance. |
void iris_thread_work_free (IrisThreadWork *thread_work);
Frees the resources associated with an IrisThreadWork.
|
An IrisThreadWork |
void iris_thread_work_run (IrisThreadWork *thread_work);
Executes the thread work. This method is called from within the worker thread.
|
An IrisThreadWork |