Project

General

Profile

Revision 957

Slight corrections to this file. I have no way
of testing without a computer with matlab/linux.

If anyone knows windows threading I'd be much
obliged. Alternatively, if anyone knows if there
is an accessible build of gcc higher then version
4 on andrew unix let me know.

View differences:

test.c
9 9
void mexFunction(int nlhs, 
10 10
	mxArray* ret[], int nrhs, const mxArray* args[])
11 11
{
12
	Return stuff to matlab
13 12
	//deliberately ignore nrhs.	
14 13
	if(nlhs != 1){
15 14
		mexErrMsgTxt("Error - only returns one number.\n");
16 15
	}
17 16
	else{
17
		
18 18
		if(first_time){
19
			//Deploy a thread to count.
19 20
			pthread_create(&counter, NULL, count, NULL);
20 21
		}
21
		//Deploy a thread to count.
22 22

  
23
		ret[0] = mxCreateDoubleMatrix(num_buffer_elements, 2, mxREAL);
23
		ret[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
24 24
		double* value = mxGetPr(ret[0]);
25 25
		*value = (double)global;	
26 26
	}

Also available in: Unified diff