CspChan

Languages and libraries

concurrency library

SHOW HN2023

Legend

CspChan

A pure C89 implementation of Go channels, with blocking selects

github.com

#c89#go channels#csp#blocking select#pthreads

271points
166comments
#176of 3,109 in 2023
Top 6%of 2023 by points

How HN took it

DebatedReal support and real criticism

15 positive, 23 neutral or asking, 0 mixed, 16 critical, out of 54 comments about the project. Thread score +0.03.

Design: 7 for, 4 againstExecution: 0 for, 7 againstIdea: 3 for, 1 againstDocs: 1 for, 3 againstPerformance: 1 for, 1 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Clean, easy-to-use design.

    From 1 comment
    • not being a god level programmer i wont go into quality of code, but this looks to me really neat and easy to use. well done!
      sim7c00 on HN
  • Useful for constrained or portable C targets.

    From 1 comment
    • I love seeing projects like this, thanks for sharing. I've worked in constrained environments before where anything past C89 was trouble, it's a nice target for portability even…
      solid_fuel on HN

Objections

  • Not truly pure C89; uses non-standard constructs and headers.

    From 2 comments
    • 1. There is no <memory.h> in any version of ISO C, nor in POSIX. 2. This is not C89; at best GNU C 89, because a variable is declared after a statement: ``` { if( msgLen == 0 )…
      kazinator on HN
    • Even looking at simple code example, with casting from/to void, returning 0 as void etc, I cannot understand how people are calling C easy and productive language
      galkk on HN
  • API lacks custom allocator, logging, and fd-based select integration.

    From 1 comment
    • It's 2023 - even MSVC has supported C11 and C17 for a while now. C89 is no longer a feature to advertise, it's an unhelpful constraint forcing poorer quality code. A good example…
      eqvinox on HN
  • Closed-channel check is racy.

    From 1 comment
    • while (!CspChan_closed(chan)) { ... } seems like a concurrency footgun – what's stopping the channel from being closed in between the check for it being closed and the operation…
      vore on HN

Requests

  • Document edge cases such as sending to a closed channel.

    From 1 comment
    • Very interesting! I program a lot in Go, and while I have my complaints about the language, I find the CSP model to be very easy to work with. I'd recommend adding some…
      openasocket on HN
  • Add benchmarks.

    From 1 comment
    • Very interesting! I program a lot in Go, and while I have my complaints about the language, I find the CSP model to be very easy to work with. I'd recommend adding some…
      openasocket on HN
  • Provide a plain Makefile.

    From 1 comment
    • Thanks for this. It would actually be nice to have a plain old Makefile. The .pro file doesn't look like anything I know.
      hollimolli on HN

Questions

  • Are unbuffered channels slow due to scheduling thrashing?

    From 1 comment
    • Wow, thank you for this. Good work! Some thoughts: I've often thought that unbuffered channels would cause scheduling thrashing - higher latency and lower throughput because…
      samsquire on HN
  • Are channels a good concurrency primitive for application code?

    From 1 comment
    • Sorry for going a bit off-topic, but something I'm curious about: are channels thought to be a good/useful tool for concurrent programming? My feeling is that they're probably…
      iainmerrick on HN

Alternatives named

  • libmill and libdill

    From 2 comments
    • libmill (https://github.com/sustrik/libmill) and libdill (https://github.com/sustrik/libdill) should be similar and probably mentioned. As far as I understand the differences…
      Matthias247 on HN
    • Related is libmill, which has been around for awhile and is was previously discussed on HN: https://news.ycombinator.com/item?id=30699829 libmill supports a bunch of stuff like…
      rockwotj on HN
  • ZeroMQ inproc sockets

    From 1 comment
    • This is really cool! I do want to say though, if you're considering using this for a production system: it's worth also considering ZeroMQ inproc sockets[0]. They allow for very…
      Zambyte on HN
  • Plan 9 libthread

    From 2 comments
    • fun fact - Go Channels started out as pretty thin syntax sugar over features provided by Plan9's C libthread.
      p_l on HN
    • Basically what ended up replacing Alef in Plan 9. https://9p.io/magic/man2html/2/thread
      pjmlp on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/38632970)