~ubuntu-branches/ubuntu/lucid/cmake/lucid

« back to all changes in this revision

Viewing changes to Tests/CTestTestParallel/lockFile.c

  • Committer: Bazaar Package Importer
  • Author(s): Artur Rona
  • Date: 2009-12-16 11:11:54 UTC
  • mfrom: (3.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20091216111154-6accvv6yq86h2hkc
Tags: 2.8.0-5ubuntu1
* Merge from debian testing (LP: #497349). Remaining changes:
  - Keep the Replaces: on cmake-data to cover the Kubuntu version from
    Jaunty in case someone decides to do an (unsupported) Jaunty->Lucid
    upgrade.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
 
 
3
/*if run serially, works fine.
 
4
  If run in parallel, someone will attempt to delete
 
5
  a locked file, which will fail */
 
6
int main(void)
 
7
{
 
8
  FILE* file;
 
9
  int i;
 
10
  const char* fname = "lockedFile.txt";
 
11
  file = fopen(fname, "w");
 
12
 
 
13
  for(i = 0; i < 10000; i++)
 
14
    {
 
15
    fprintf(file, "%s", "x");
 
16
    fflush(file);
 
17
    }
 
18
  fclose(file);
 
19
  return remove(fname);
 
20
}