Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Enabling file system

SaeHie Park edited this page Jul 15, 2015 · 4 revisions

File system in libuv is quite complicated.

  • uses macros to INIT, PATH and POST to reduce repetitive codes.
  • uses thread pool for async capability. uses uv__work_submit in POST to send to work thread
  • thread pool uses mutex and signal

Threading

Linux uses pthread as uv_thread and pthread_mutex as uv_mutex, pthread_cond as uv_cond

Threadpool

Threadpool of worker

Worker

  • add work calling uv__work_submit() with struct uv__work having work and done
  • work is a function to execute in thread
  • done is a function to be called after work is finished through calling uv_async_send()

async and io

  • sync is used to handle work done
  • inside async is io with uv__io_t structure for holding cb and watch fd
  • worker calls uv_async_send which calls uv__async_send() to write one byte to wa->wfd to signal
  • this is watched in uv__io_poll() with uv__epoll_pwait() and cb will be called which is done

system call

Clone this wiki locally