3 ms·
Is using recv not a problem as there is the recv(2)? Do I understand correctly that there can be only one instance of a module? Why then use string identifiers
by hawski 9y ago
Is using recv not a problem as there is the recv(2)?
Do I understand correctly that there can be only one instance of a module? Why then use string identifiers instead of an enum?
- nierro 9y agoYou are probably right about recv; i'll change it to "receive" as soon as i get home (patch welcome though). There can only be one instance, you're right. String identifiers are human friendly; moreover i can't see how an enum could fit there, care to explain? Thanks! Btw you can have same module name in different contexts.
- hawski 9y agoI guess it would change the API. You could have a separate file where you define an enum with all module identifiers plus a max value that all modules should include. Then you could omit whole hashmap dance and just use a static array. Then even an IDE or your text editor could give completions easily. That would be less dynamic, but it's all a game of tradeoffs. It could be beneficial to also support poll, as it's more portable and should be faster for low fd number. Probably not worth the hassle for a side project though. BTW: nice clean and simple library. I'm more inclined towards libdill and coroutines, but they are certainly more complicated under the hood.
- nierro 9y agoOh i see, that is what i firstly thought reading your comment. Yes, that surely would work out pretty well and would be slightly lighter too. But it would lack flexibility and simplicity that are my key points for libmodule. Thanks for your suggestion and feedback though, they are really appreciated. And thanks for the hint on recv(), how could i miss that!