/ani/mrses

To get this branch, use:
bzr branch http://darksoft.org/webbzr/ani/mrses
1 by Suren A. Chilingaryan
Initial import
1
#ifndef _HW_THREAD_H
2
#define _HW_THREAD_H
3
4
typedef struct HWThreadT *HWThread;
5
typedef int (*HWRunFunction)(HWThread thread, void *ctx, int block, void *attr);
6
typedef int (*HWFreeFunction)(void *ctx);
7
8
#include "hw_sched.h"
9
10
enum HWThreadStatusT {
11
    HW_THREAD_STATUS_IDLE = 0,
12
    HW_THREAD_STATUS_RUNNING = 1,
13
    HW_THREAD_STATUS_DONE = 2,
14
    HW_THREAD_STATUS_INIT = 3
15
};
16
typedef enum HWThreadStatusT HWThreadStatus;
17
18
19
#ifndef HW_HIDE_DETAILS
20
#include <pthread.h>
21
struct HWThreadT {
22
    int thread_id;
23
    HWSched sched;
24
    
25
    pthread_t thread;
26
    
27
    void *hwctx;
28
    HWRunFunction *run;
29
    HWFreeFunction free;
30
    
31
    HWThreadStatus status;
32
33
    void *data;			/**< Per-thread data storage, will be free'd if set */
34
};
35
typedef struct HWThreadT HWThreadS;
36
#endif /* HW_HIDE_DETAILS */
37
38
HWThread hw_thread_create(HWSched sched, int thread_id, void *hwctx, HWRunFunction *run_func, HWFreeFunction free_func);
39
void hw_thread_destroy(HWThread ctx);
40
41
42
#endif /* _HW_THREAD_H */