/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1999-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#include "dttest.h"
/* Test concurrency usage of the method Dtrhset.
**
** Written by Kiem-Phong Vo
*/
#ifndef N_PROC
#endif
typedef struct _obj_s
} Obj_t;
typedef struct _proc_s
} Proc_t;
typedef struct _state_s
unsigned int idone;
unsigned int ddone;
} State_t;
typedef struct _disc_s
unsigned int lock;
unsigned char* addr;
} Disc_t;
/* memory allocator for shared dictionary - no freeing here */
{
int k;
break;
}
else terror("Out of shared memory");
return addr;
}
int status;
if(WIFSIGNALED(status))
}
st = "coredump";
else st = "normal";
}
{
ssize_t k, s;
/* insert objects in 'p' */
usleep(100);
{ if(k && k%PROGRESS == 0)
Icount += 1;
if(k > SEARCH ) /* search a few elements known to be inserted */
{ for(s = 0; s < SEARCH; ++s)
tinfo("\t\tProcess %d(%d): Srch %s(Max %s) get %0x",
}
}
}
usleep(100);
/* delete objects in 'p' and also in "foe" of p */
usleep(100);
{ if(k && k%PROGRESS == 0)
Dcount += 1;
if(k > SEARCH)
{ for(s = 0; s < SEARCH; ++s)
}
}
}
}
tmain()
{
Obj_t *o;
int zerof;
tchild();
/* get shared memory */
k = 64*1024*1024;
sizeof(Disc_t) /* discipline */ +
k; /* table memory */
terror("mmap failed");
/* construct the objects to be inserted */
for(k = 0; k < N_OBJ; ++k)
}
/* construct the work-load for each process */
for(k = 1; k < N_PROC; ++k)
}
/* now create the shared dictionary */
terror("Cannot open dictionary");
terror("Cannot turn on share mode");
#if N_PROC == 1
Pnum = 1;
#else
for(k = 0; k < N_PROC; ++k)
terror("Can't create child process");
else if(pid[k] > 0) /* parent */
else
{ Pnum = k+1;
texit(0);
}
}
#endif
break;
tinfo("\ttsafehash: Insertion completed, checking integrity");
for(k = 0; k < N_OBJ; ++k)
break;
terror("Dictionary not empty after deletion!");
z = 0;
for(k = 0; k < N_OBJ; ++k)
z += 1;
if(z != N_OBJ)
twarn("Some deletion was not properly recorded?");
tinfo("\ttsafehash: All testing done.");
texit(0);
}