/fhn

Fetch hacker news (many languages)

Primary LanguageZigMIT LicenseMIT

What to do (basic):

What to do (plus):

  • configurable threads / default to NPROC
  • configurable number of headlines / default 500
  • minimal use of no standard libraries
  • crosscompile and run it in windows

challenges:

  • How to spawn threads

  • How to discovery NPROC

  • How to sync threads

  • How to parse json

  • How to do a HTTP fetch

  • Trouble with TLS (HTTPS)?

  • HACKER NEWS API:


"Do not communicate by sharing memory; instead, share memory by communicating." https://github.com/golang/go/wiki/MutexOrChannel https://medium.com/mindorks/https-medium-com-yashishdua-synchronizing-states-using-mutex-vs-channel-in-go-25e646c83567

Channel (distribute ownership):

  • passing ownership of data,
  • distributing units of work,
  • communicating async results

Mutex (share resources):

  • caches,
  • state