zetzit / zz

πŸΊπŸ™ ZetZ a zymbolic verifier and tranzpiler to bare metal C
MIT License
1.6k stars 52 forks source link

async on windows #115

Closed peirick closed 3 years ago

peirick commented 3 years ago

Hi Arvid,

I did a rebase on master with your async branch and added a basic windows implementation for async read and write for console input and output. The async test application is working so far. As conclusion could be said that your async API design should basically work on windows.

Something that could be better for the windows async would be if the driver is put where you create the "device". So instead of new input = async::stdio::stdin(&e); do new input = async::stdio::stdin(&e, &driver); because now the "binding" between driver and "device", happens lazy when the first read / write is executed. But that is totally your decision, and maybe there are reasons of that API design as it is.

Regards

Tobias

aep commented 3 years ago

NICE

totally fine to change the api.

don't worry about the failure on the other OS's for now, i can fix this later when the api is settled.

peirick commented 3 years ago

I did some further research. Best du use a library like "libuv", that is nicely wrapping all that stuff. If its only for sockets there is also "wepoll".

aep commented 3 years ago

libuv only works on desktop-os (zetz specifically targets embedded systems and wasm as well) and is heap allocation based (zetz does not allocate)

peirick commented 3 years ago

Ah, okay. Yeah I forgot that global requirement!

peirick commented 3 years ago

I will reopen a new MR if I get something better.