1 
2 /*-------------------------------------------------------------*/
3 typedef struct netwib_thread netwib_thread;
4 
5 /*-------------------------------------------------------------*/
6 /* thread ends when this function returns */
7 typedef netwib_err (*netwib_thread_pf)(netwib_ptr infosin,
8                                        netwib_ptr *pinfosout);
9 
10 /*-------------------------------------------------------------*/
11 /* Name : netwib_thread_init
12    Description :
13      Create a new thread, which will execute *pfunc and exit.
14    Input parameter(s) :
15      *pfunc : function executed by the new thread :
16               infosin : set with infosin
17               pinfosout : eventually set by user
18      infosin : data to pass to the thread
19    Input/output parameter(s) :
20    Output parameter(s) :
21      **ppthread : thread created
22    Normal return values :
23      NETWIB_ERR_OK : ok
24 */
25 netwib_err netwib_thread_init(netwib_thread_pf pfunc,
26                               netwib_ptr infosin,
27                               netwib_thread **ppthread);
28 
29 /*-------------------------------------------------------------*/
30 /* Name : netwib_thread_close
31    Description :
32      Free memory allocated by a netwib_thread.
33      Note : this function does not terminate the thread.
34             function netwib_thread_wait must be called before
35    Input parameter(s) :
36    Input/output parameter(s) :
37      **ppthread : thread to free
38    Output parameter(s) :
39    Normal return values :
40      NETWIB_ERR_OK : ok
41 */
42 netwib_err netwib_thread_close(netwib_thread **ppthead);
43 
44 /*-------------------------------------------------------------*/
45 /* Name : netwib_thread_wait
46    Description :
47      Wait for the end of the thread.
48    Input parameter(s) :
49      *pthread : thread to wait for
50      *pabstime : end time. If *pabstime is reached, function
51                  returns (*pevent set to NETWIB_FALSE).
52    Input/output parameter(s) :
53    Output parameter(s) :
54      *pevent : true if thread ended
55      *preturnederror : value returned by the thread
56      *pinfosout : info eventually set by thread
57    Normal return values :
58      NETWIB_ERR_OK : ok
59 */
60 netwib_err netwib_thread_wait(netwib_thread *pthread,
61                               netwib_consttime *pabstime,
62                               netwib_bool *pevent,
63                               netwib_err *preturnederror,
64                               netwib_ptr *pinfosout);
65