Changeset d48b174
- Timestamp:
- Jan 12, 2021, 12:57:59 PM (3 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 35285fd
- Parents:
- 58f99b3
- Location:
- libcfa/src/concurrency
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io.cfa
r58f99b3 rd48b174 31 31 32 32 extern "C" { 33 #include <sys/epoll.h>34 #include <sys/eventfd.h>35 33 #include <sys/syscall.h> 36 34 … … 266 264 267 265 void main( $io_ctx_thread & this ) { 268 epoll_event ev; 269 __ioctx_register( this, ev ); 266 __ioctx_register( this ); 270 267 271 268 __cfadbg_print_safe(io_core, "Kernel I/O : IO poller %d (%p) ready\n", this.ring->fd, &this); … … 303 300 // we need to retry one last time in case 304 301 // something completed *just now* 305 __ioctx_prepare_block( this , ev);302 __ioctx_prepare_block( this ); 306 303 continue LOOP; 307 304 } … … 314 311 // block this thread 315 312 wait( this.sem ); 316 317 eventfd_t v;318 eventfd_read(this.ring->efd, &v);319 313 320 314 // restore counter -
libcfa/src/concurrency/io/setup.cfa
r58f99b3 rd48b174 190 190 __cfaabi_tls.this_stats = io_ctx->self.curr_cluster->stats; 191 191 #endif 192 193 eventfd_t v; 194 eventfd_read(io_ctx->ring->efd, &v); 195 192 196 post( io_ctx->sem ); 193 197 } … … 494 498 // I/O Context Sleep 495 499 //============================================================================================= 496 497 void __ioctx_register($io_ctx_thread & ctx, struct epoll_event & ev) { 498 ev.events = EPOLLIN | EPOLLET | EPOLLONESHOT; 500 #define IOEVENTS EPOLLIN | EPOLLONESHOT 501 502 static inline void __ioctx_epoll_ctl($io_ctx_thread & ctx, int op, const char * error) { 503 struct epoll_event ev; 504 ev.events = IOEVENTS; 499 505 ev.data.u64 = (__u64)&ctx; 500 int ret = epoll_ctl(iopoll.epollfd, EPOLL_CTL_ADD, ctx.ring->efd, &ev);506 int ret = epoll_ctl(iopoll.epollfd, op, ctx.ring->efd, &ev); 501 507 if (ret < 0) { 502 abort( "KERNEL ERROR: EPOLL ADD - (%d) %s\n", (int)errno, strerror(errno) ); 503 } 504 } 505 506 void __ioctx_prepare_block($io_ctx_thread & ctx, struct epoll_event & ev) { 508 abort( "KERNEL ERROR: EPOLL %s - (%d) %s\n", error, (int)errno, strerror(errno) ); 509 } 510 } 511 512 void __ioctx_register($io_ctx_thread & ctx) { 513 __ioctx_epoll_ctl(ctx, EPOLL_CTL_ADD, "ADD"); 514 } 515 516 void __ioctx_prepare_block($io_ctx_thread & ctx) { 507 517 __cfadbg_print_safe(io_core, "Kernel I/O - epoll : Re-arming io poller %d (%p)\n", ctx.ring->fd, &ctx); 508 int ret = epoll_ctl(iopoll.epollfd, EPOLL_CTL_MOD, ctx.ring->efd, &ev); 509 if (ret < 0) { 510 abort( "KERNEL ERROR: EPOLL REARM - (%d) %s\n", (int)errno, strerror(errno) ); 511 } 518 __ioctx_epoll_ctl(ctx, EPOLL_CTL_MOD, "REARM"); 512 519 } 513 520 -
libcfa/src/concurrency/io/types.hfa
r58f99b3 rd48b174 131 131 #endif 132 132 133 struct epoll_event;134 133 struct $io_ctx_thread; 135 void __ioctx_register($io_ctx_thread & ctx , struct epoll_event & ev);136 void __ioctx_prepare_block($io_ctx_thread & ctx , struct epoll_event & ev);134 void __ioctx_register($io_ctx_thread & ctx); 135 void __ioctx_prepare_block($io_ctx_thread & ctx); 137 136 #endif 138 137
Note: See TracChangeset
for help on using the changeset viewer.