/ani/mrses

To get this branch, use:
bzr branch http://de.suren.me/webbzr/ani/mrses
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef _HW_THREAD_H
#define _HW_THREAD_H

typedef struct HWThreadT *HWThread;
typedef int (*HWRunFunction)(HWThread thread, void *ctx, int block, void *attr);
typedef int (*HWFreeFunction)(void *ctx);

#include "hw_sched.h"

enum HWThreadStatusT {
    HW_THREAD_STATUS_IDLE = 0,
    HW_THREAD_STATUS_RUNNING = 1,
    HW_THREAD_STATUS_DONE = 2,
    HW_THREAD_STATUS_INIT = 3
};
typedef enum HWThreadStatusT HWThreadStatus;


#ifndef HW_HIDE_DETAILS
#include <pthread.h>
struct HWThreadT {
    int thread_id;
    HWSched sched;
    
    pthread_t thread;
    
    void *hwctx;
    HWRunFunction *run;
    HWFreeFunction free;
    
    HWThreadStatus status;

    void *data;			/**< Per-thread data storage, will be free'd if set */
};
typedef struct HWThreadT HWThreadS;
#endif /* HW_HIDE_DETAILS */

HWThread hw_thread_create(HWSched sched, int thread_id, void *hwctx, HWRunFunction *run_func, HWFreeFunction free_func);
void hw_thread_destroy(HWThread ctx);


#endif /* _HW_THREAD_H */