static void FBIF_send (void) /* Send a message to a thread. */ { FACT_num_t dest, msg; // printf("entered\n"); msg = GET_ARG_NUM (); dest = GET_ARG_NUM (); FACT_send_message (msg, mpc_get_ui (dest->value)); push_constant_ui (0); }
return FACT_get_ui (FACT_get_curr_thread ()->nid); } FACT_DEFINE_BIF (get_thread_status, "def tid") { /** * get_thread_status - returns true if a thread has exited and * false otherwise. * * @tid: The thread id of the thread to test. */ unsigned long i; unsigned long tid; FACT_thread_t *curr; tid = mpc_get_ui ((get_var (scope, "tid"))->data); // Convert the var_t to a ulong. if (tid < 0) // If the tid is invalid, throw an error. FACT_ret_error (scope, "invalid thread id"); curr = root_thread; for (i = 0; i < tid; i++) { curr = curr->next; if (curr == NULL) FACT_ret_error (scope, "invalid thread id"); } return FACT_get_ui (i); } FACT_DEFINE_BIF (queue_size, NOARGS)