File: nopthread.h

package info (click to toggle)
courier 0.47-4sarge5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 32,680 kB
  • ctags: 12,265
  • sloc: ansic: 164,045; cpp: 23,863; sh: 19,569; perl: 7,225; makefile: 4,192; yacc: 316; sed: 16
file content (44 lines) | stat: -rw-r--r-- 1,136 bytes parent folder | download | duplicates (5)
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
43
44
#ifndef	nopthread_h
#define	nopthread_h

/*
** Copyright 2000 Double Precision, Inc.  See COPYING for
** distribution information.
*/

static const char nopthread_h_rcsid[]="$Id: nopthread.h,v 1.1 2000/01/18 02:32:23 mrsam Exp $";

#if	HAVE_CONFIG_H
#include	"config.h"
#endif

struct cthreadinfo {
	void (*workfunc)(void *);
	void (*cleanupfunc)(void *);
	char *metadata_buf;
	} ;

struct cthreadinfo *cthread_init(
	unsigned,		/* Number of threads */
	unsigned,		/* Size of per-thread metadata */
	void (*)(void *),	/* The work function */
	void (*)(void *));	/* The cleanup function */

void cthread_wait(struct cthreadinfo *);

#define	cthread_go(cit, gofunc, arg)	\
	( (*gofunc)(cit->metadata_buf, arg),	\
		(*cit->workfunc)(cit->metadata_buf), \
		(*cit->cleanupfunc)(cit->metadata_buf), 0)

struct cthreadlock *cthread_lockcreate(void);
void cthread_lockdestroy(struct cthreadlock *);
int cthread_lock(struct cthreadlock *, int (*)(void *), void *);

extern struct cthreadlock cthread_dummy;

#define	cthread_lockcreate()	( &cthread_dummy )
#define	cthread_lockdestroy(p)
#define	cthread_lock(p,func,arg)	( (*func)(arg))

#endif