-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Hi @amcolex, I was looking through the code and saw a bunch of interesting ideas, especially the gen side for the boilerplate messages. Overall it's well done but a few things caught my attention and wanted to know what were your thoughts about concurrency.
I see each .c contains n instance messages. Each message metadata contains a single linked list for the subscription. However the sublist is not protected by a lock so technically it is possible you can end up with a memory leak + missed subscription because you malloc and potentially add to a list that can be changed by two threads at the same time.
Another issue is with the peek that reads the counter (or overall any method that reads the instance values and does something with it). If the counter > 0 and while you copy the value is changed then you might memcpy some random data.
I think the library needs some sort of synchronization + a lock object on the msg instance and I'm happy to try to send you a PR later this year if you are interested.
Thanks!