luvit-api-design icon indicating copy to clipboard operation
luvit-api-design copied to clipboard

`thread` module design

Open RiskoZoSlovenska opened this issue 2 years ago • 0 comments

Just spitballing some ideas.

  1. Provide a shortcut reference to uv.new_async (thread.new_async? Would have to decide on naming style), since async really only has use in the context of multiple threads (correct me if it doesn't).
  2. Remove join, equals and queue, since those already exist as member methods.
  3. Have work take only a single thread_entry argument and have Worker:queue() yield the current coroutine (something along the lines of this). This is probably the biggest one I'd personally like to see.
  4. Automatically attempt to serialize/deserialize tables into json, only throwing an error if that fails instead of every time a table is passed. Probably the iffiest suggestion here (user might expect tables to be equal, etc), but it could be useful occasionally.
  5. Automatically attempt to serialize/deserialize functions into bytecode instead of throwing an error if a function is passed. Iffy for the same reasons as mentioned above.

RiskoZoSlovenska avatar Mar 02 '22 16:03 RiskoZoSlovenska