Beispiel #1
0
/**
 * Assign a task to the worker by sending an assign message to that worker
 */
void LpelWorkerRunTask(lpel_task_t *t) {
	 workermsg_t msg;
   msg.type = WORKER_MSG_ASSIGN;
	 msg.body.task = t;

	if (t->worker_context != NULL) {	// wrapper
		LpelMailboxSend(t->worker_context->mailbox, &msg);
	}	else {
		LpelMailboxSend(mastermb, &msg);
	}
}
Beispiel #2
0
static void sendWakeup(mailbox_t *mb, lpel_task_t *t)
{
	workermsg_t msg;
	msg.type = WORKER_MSG_WAKEUP;
	msg.body.task = t;
	LpelMailboxSend(mb, &msg);
}
Beispiel #3
0
static void sendTask(int wid, lpel_task_t *t) {
	assert(t->state == TASK_READY);
	workermsg_t msg;
	msg.type = WORKER_MSG_ASSIGN;
	msg.body.task = t;
	LpelMailboxSend(workermbs[wid], &msg);
 }
Beispiel #4
0
static inline void SendWakeup( workerctx_t *target, lpel_task_t *t)
{
  workermsg_t msg;
  /* compose a task wakeup message */
  msg.type = WORKER_MSG_WAKEUP;
  msg.body.task = t;
  /* send */
  LpelMailboxSend(target->mailbox, &msg);
}
Beispiel #5
0
static inline void SendAssign( workerctx_t *target, lpel_task_t *t)
{
  workermsg_t msg;
  /* compose a task assign message */
  msg.type = WORKER_MSG_ASSIGN;
  msg.body.task = t;


  /* send */
  LpelMailboxSend(target->mailbox, &msg);
}
Beispiel #6
0
void LpelWorkerBroadcast(workermsg_t *msg)
{
  int i;
  workerctx_t *wc;

  for( i=0; i<num_workers; i++) {
    wc = WORKER_PTR(i);
    /* send */
    LpelMailboxSend(wc->mailbox, msg);
  }
}
Beispiel #7
0
void LpelWorkerBroadcast(workermsg_t *msg)
{
	int i;
	mailbox_t *wmb;

	for(i=0; i<num_workers; i++) {
		wmb = workermbs[i];
		/* send */
		LpelMailboxSend(wmb, msg);    
	}
}
Beispiel #8
0
static void requestTask(workerctx_t *wc) {
	WORKER_DBG("worker %d: request task\n", wc->wid);
	workermsg_t msg;
	msg.type = WORKER_MSG_REQUEST;
	msg.body.from_worker = wc->wid;
	LpelMailboxSend(mastermb, &msg);
#ifdef USE_LOGGING
	if (wc->mon && MON_CB(worker_waitstart)) {
		MON_CB(worker_waitstart)(wc->mon);
	}
#endif
}
Beispiel #9
0
/*
 * Terminate master and workers
 */
void LpelWorkersTerminate(void) {
	workermsg_t msg;
	msg.type = WORKER_MSG_TERMINATE;
	LpelMailboxSend(master->mailbox, &msg);
}
Beispiel #10
0
static void returnTask(lpel_task_t *t) {
	workermsg_t msg;
	msg.type = WORKER_MSG_RETURN;
	msg.body.task = t;
	LpelMailboxSend(mastermb, &msg);
}