File: nopthread.c

package info (click to toggle)
courier 1.5.1-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 54,460 kB
  • sloc: ansic: 130,619; cpp: 33,255; sh: 10,437; perl: 4,250; makefile: 3,447; sed: 39
file content (48 lines) | stat: -rw-r--r-- 808 bytes parent folder | download | duplicates (11)
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
45
46
47
48
/*
** Copyright 2000-2001 Double Precision, Inc.  See COPYING for
** distribution information.
*/


#include	"threadlib.h"

#include	<stdio.h>
#include	<errno.h>
#include	<stdlib.h>
#include	<unistd.h>

typedef struct cthreadinfo cthreadinfo_t;


cthreadinfo_t *cthread_init(unsigned nthreads_, unsigned metasize,
	void (*workfunc_)(void *),
	void (*cleanupfunc_)(void *))
{
cthreadinfo_t *cit;

	if ((cit=(cthreadinfo_t *)malloc(sizeof(cthreadinfo_t))) == 0)
		return (0);

	cit->cleanupfunc=cleanupfunc_;
	cit->workfunc=workfunc_;

	if ( (cit->metadata_buf=malloc(metasize)) == 0)
	{
		free( (char *)cit );
		return (0);
	}
	return (cit);
}

void cthread_wait(cthreadinfo_t *cit)
{
	free(cit->metadata_buf);
	free( (char *)cit);
}


struct cthreadlock {
	int dummy;
	} ;

struct cthreadlock cthread_dummy;