Some types
This commit is contained in:
parent
7829fb1457
commit
e42534dc90
|
@ -37,6 +37,10 @@ struct {
|
|||
int *space;
|
||||
} typedef IntArray_t;
|
||||
|
||||
//
|
||||
// Scheduler
|
||||
//
|
||||
|
||||
struct {
|
||||
BoolArray_t *globalPreemptionSpace;
|
||||
IntArray_t *globalDrawingSpace;
|
||||
|
@ -45,3 +49,17 @@ struct {
|
|||
int nmaxThread;
|
||||
int nmaxCycles;
|
||||
} typedef SchedulerParams_t;
|
||||
|
||||
//
|
||||
// Local threads
|
||||
//
|
||||
struct {
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
} typedef Center_t;
|
||||
|
||||
struct {
|
||||
pthread_t *id;
|
||||
Center_t *localWorkAreaCenter;
|
||||
} typedef Thread_t;
|
||||
|
|
32
src/main.c
32
src/main.c
|
@ -35,14 +35,18 @@ int main(int argc, char **argv)
|
|||
//
|
||||
// Creating parameters structure for the Scheduler
|
||||
//
|
||||
SchedulerParams_t *parameters = NULL;
|
||||
SchedulerParams_t *parameters =
|
||||
(SchedulerParams_t*) malloc(sizeof(SchedulerParams_t));
|
||||
|
||||
parameters->globalPreemptionSpace = (BoolArray_t*) malloc(sizeof(BoolArray_t));
|
||||
parameters->globalPreemptionSpace->space = (bool*) malloc(sizeof(bool)*SPACE_SIZE);
|
||||
parameters->globalPreemptionSpace =
|
||||
(BoolArray_t*) malloc(sizeof(BoolArray_t));
|
||||
parameters->globalPreemptionSpace->space =
|
||||
(bool*) malloc(sizeof(bool)*SPACE_SIZE);
|
||||
parameters->globalPreemptionSpace->size = SPACE_SIZE;
|
||||
|
||||
parameters->globalDrawingSpace = (IntArray_t*) malloc(sizeof(IntArray_t));
|
||||
parameters->globalDrawingSpace->space = (int*) malloc(sizeof(int)*SPACE_SIZE);
|
||||
parameters->globalDrawingSpace->space =
|
||||
(int*) malloc(sizeof(int)*SPACE_SIZE);
|
||||
parameters->globalDrawingSpace->size = SPACE_SIZE;
|
||||
|
||||
parameters->arrowList = (IntArray_t*) malloc(sizeof(IntArray_t));
|
||||
|
@ -70,5 +74,25 @@ int main(int argc, char **argv)
|
|||
free(parameters->arrowList->space);
|
||||
free(parameters->arrowList);
|
||||
|
||||
free(parameters);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void SchedulerCrashTest(void)
|
||||
{
|
||||
const int maxthread = 100;
|
||||
|
||||
SchedulerParams_t *parameters =
|
||||
(SchedulerParams_t*) calloc(1, sizeof(SchedulerParams_t));
|
||||
|
||||
pthread_t **schedThread =
|
||||
(pthread_t**) malloc(sizeof(pthread_t*) * maxthread);
|
||||
|
||||
for (int i=0; i < 16; i++) {
|
||||
schedThread[i] = SchedInit(parameters);
|
||||
}
|
||||
|
||||
free(parameters);
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ void SchedWait(pthread_t *schedThread)
|
|||
// -------------------------------------------------------------------------- //
|
||||
static void *GreatScheduler(void *parameters)
|
||||
{
|
||||
sleep(1);
|
||||
printf("Printing from thread \n");
|
||||
sleep(1);
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue