/ani/mrses

To get this branch, use:
bzr branch http://darksoft.org/webbzr/ani/mrses

« back to all changes in this revision

Viewing changes to cell/hw_thread.h

  • Committer: Suren A. Chilingaryan
  • Date: 2010-04-28 04:30:08 UTC
  • Revision ID: csa@dside.dyndns.org-20100428043008-vd9z0nso9axezvlp
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 */