/*!\file:  WriteLockFile.cpp
 * \brief
 */ 
#undef __FUNCT__ 
#define __FUNCT__ "WriteLockFile"

#include "stdio.h"
#include "../shared/shared.h"

void WriteLockFile(char* filename){

	int i;
	extern int my_rank;
	
	/* output: */
	FILE* fid=NULL;

	/* Open lock file and write 1 into it: */
	if(my_rank==0){
		fid=fopen(filename,"w");
		if(fid==NULL)throw ErrorException(__FUNCT__,exprintf("%s%s","error message: could not open lock file ",filename));

		/*Close file: */
		if(fclose(fid)!=0)throw ErrorException(__FUNCT__,exprintf("%s%s","could not close lock file ",filename));
	}

}	
