Chimera: chimera_0-9/src/job_queue.c File Reference

- Main Page
- Classes
- Files
- Directories

- File List
- File Members

# job_queue.c File Reference

`#include <stdio.h>`
`#include <string.h>`
`#include <stdlib.h>`
`#include <pthread.h>`
`#include "job_queue.h"`

## Functions
node * | list_get (List *l)
node * | list_make_node (FuncPtr func, void *args, int args_size)
void | list_insert (List *l, node *new)
int | list_empty (List *l)
List * | list_init ()
void | free_node (node *n)
void * | job_exec (void *job_q)
void | job_submit (List *job_q, FuncPtr func, void *args, int args_size)
List * | job_queue_init (int pool_size)

## Function Documentation

void free_node | ( | node * | n | ) |

void* job_exec | ( | void * | job_q | ) |

| get the queue mutex "access" then if the queue is emapty it would go to sleep and release the mutex else get the first job out of queue and execute it

List* job_queue_init | ( | int | pool_size | ) |

| initiate the queue and thread pool, returns a pointer to the initiated queue.

void job_submit | ( | List * | job_q,
|  | FuncPtr | func,
|  | void * | args,
|  | int | args_size
| ) |

| get the queue mutex "access", creat a new node and pass func,args,args_size, add the new node to the queue, and signal the thread pool if the queue was empty.

int list_empty | ( | List * | l | ) |

node* list_get | ( | List * | l | ) |

List* list_init | ( |  | ) |

| initiate the list(queue).

void list_insert | ( | List * | l,
|  | node * | new
| ) |

node* list_make_node | ( | FuncPtr | func,
|  | void * | args,
|  | int | args_size
| ) |