Sha256: 80e8ec9d5492d5f09e608d9fe830f445e22b2f877325dc43df3033e1d8afa85a

Contents?: true

Size: 1.1 KB

Versions: 86

Compression:

Stored size: 1.1 KB

Contents

#ifdef POLYPHONY_PLAYGROUND

#include <netdb.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <unistd.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <arpa/inet.h>

#include "polyphony.h"
#include "../liburing/liburing.h"
#include "ruby/thread.h"

#include <poll.h>
#include <sys/types.h>
#include <sys/eventfd.h>
#include <sys/wait.h>
#include <time.h>
#include <stdnoreturn.h>

void print(struct io_uring *ring, const char *str) {
  struct io_uring_sqe *sqe = io_uring_get_sqe(ring);
  io_uring_prep_write(sqe, 1, str, strlen(str), -1);
  io_uring_sqe_set_data(sqe, (void *)42);
  // io_uring_sqe_set_flags(sqe, IOSQE_ASYNC);
  io_uring_submit(ring);

  struct io_uring_cqe *cqe;
  int ret = __io_uring_get_cqe(ring, &cqe, 0, 1, NULL);
  if (ret != 0) {
    printf("ret: %d\n", ret);
    exit(1);
  }
  printf("  cqe res: %d\n", cqe->res);
  io_uring_cqe_seen(ring, cqe);
}

noreturn void playground() {
  struct io_uring ring;
  io_uring_queue_init(1024, &ring, 0);

  for (int i = 0; i < 10; i++) {
    print(&ring, "hi\n");
  }

  io_uring_queue_exit(&ring);
  exit(0);
}

#endif //POLYPHONY_PLAYGROUND

Version data entries

86 entries across 86 versions & 1 rubygems

Version Path
polyphony-1.6 ext/polyphony/playground.c
polyphony-1.5 ext/polyphony/playground.c
polyphony-1.4 ext/polyphony/playground.c
polyphony-1.3 ext/polyphony/playground.c
polyphony-1.2.1 ext/polyphony/playground.c
polyphony-1.2 ext/polyphony/playground.c
polyphony-1.1.1 ext/polyphony/playground.c
polyphony-1.1 ext/polyphony/playground.c
polyphony-1.0.2 ext/polyphony/playground.c
polyphony-1.0.1 ext/polyphony/playground.c
polyphony-1.0 ext/polyphony/playground.c
polyphony-0.99.6 ext/polyphony/playground.c
polyphony-0.99.5 ext/polyphony/playground.c
polyphony-0.99.4 ext/polyphony/playground.c
polyphony-0.99.3 ext/polyphony/playground.c
polyphony-0.99.2 ext/polyphony/playground.c
polyphony-0.99.1 ext/polyphony/playground.c
polyphony-0.99 ext/polyphony/playground.c
polyphony-0.98 ext/polyphony/playground.c
polyphony-0.97 ext/polyphony/playground.c