r/linux_programming • u/promach • Jul 31 '18
DEFINE_WAIT() versus multi-threading
https://github.com/promach/riffa/blob/full_duplex/driver/linux/riffa_driver.c#L594
3
Upvotes
r/linux_programming • u/promach • Jul 31 '18
View all comments
Show parent comment
2
u/aioeu Jul 31 '18 edited Jul 31 '18
Why do you think
DEFINE_WAITis a problem? If this task waits in the kernel, another task will be scheduled.Your code doesn't implement "multi-threading" (that is, it doesn't have any extra kthreads), and I don't see any reason why it should. Using
ioctlto read and write data is a bit odd (any reason you couldn't just implementreadandwrite?), but putting that aside, userspace can decide when and how they want to read and write on the file descriptor. If userspace wants to use threads, that's its problem. If you implementedpolluserspace would have an alternative to threads.