Beispiel #1
0
/**
 * Sends a message to a thread.
 */
static void send_msg(uint32_t to, sched_msg_t msg, intptr_t arg)
{
  pony_msgi_t* m = (pony_msgi_t*)pony_alloc_msg(
    POOL_INDEX(sizeof(pony_msgi_t)), msg);

  m->i = arg;
  ponyint_messageq_push(&scheduler[to].mq, &m->msg);
}
Beispiel #2
0
Datei: iocp.c Projekt: DevL/ponyc
static void send_request(asio_event_t* ev, int req)
{
  asio_backend_t* b = asio_get_backend();

  asio_msg_t* msg = (asio_msg_t*)pony_alloc_msg(
    POOL_INDEX(sizeof(asio_msg_t)), 0);
  msg->event = ev;
  msg->flags = req;
  messageq_push(&b->q, (pony_msg_t*)msg);

  SetEvent(b->wakeup);
}
Beispiel #3
0
void asio_event_send(asio_event_t* ev, uint32_t flags, uint32_t arg)
{
  asio_msg_t* m = (asio_msg_t*)pony_alloc_msg(POOL_INDEX(sizeof(asio_msg_t)),
    ev->msg_id);
  m->event = ev;
  m->flags = flags;
  m->arg = arg;

#ifdef PLATFORM_IS_WINDOWS
  // On Windows, this can be called from an IOCP callback thread, which may
  // not have a pony_ctx() associated with it yet.
  pony_register_thread();
#endif

  pony_sendv(pony_ctx(), ev->owner, &m->msg);
}
Beispiel #4
0
static void send_request(asio_event_t* ev, int req)
{
  asio_backend_t* b = ponyint_asio_get_backend();
  pony_assert(b != NULL);

  asio_msg_t* msg = (asio_msg_t*)pony_alloc_msg(
    POOL_INDEX(sizeof(asio_msg_t)), 0);
  msg->event = ev;
  msg->flags = req;
  ponyint_thread_messageq_push(&b->q, (pony_msg_t*)msg, (pony_msg_t*)msg
#ifdef USE_DYNAMIC_TRACE
    , SPECIAL_THREADID_EPOLL, SPECIAL_THREADID_EPOLL
#endif
    );

  eventfd_write(b->wakeup, 1);
}