[OpenWrt-Devel] [PATCH] libubus: handle NULL ubus_context in all sync requests by creating a local instance
ardeleanalex at gmail.com
Thu Jul 17 14:05:17 EDT 2014
Will reconsider approach in our code.
If I think about it, there may be an approach (in our code) which
requires fewer changes than this patch, and may even be more elegant.
Thanks and apologies for the noise.
On 7/17/14, Felix Fietkau <nbd at openwrt.org> wrote:
> On 2014-07-17 17:25, Alexandru Ardelean wrote:
>> This can serve as a convenience for sync requets, since no explicit
>> ubus_connect() + ubus_free() need to be done.
>> It can also help in cases where there are async + sync requests,
>> where one async request is working and sync calls are done.
>> Seems to create some weird races, probably because of possible
>> concurrent poll() calls on the same fd.
> I don't like this approach. If you want to avoid races in your code
> between async calls and sync calls, just create a separate context for
> sync calls.
> Also, allowing NULL to be passed as context creates the illusion that it
> is generally sane to do so. In the case of adding/removing objects it
> makes no sense and is completely misleading: any object that you add
> with the internally allocated ubus context gets deleted as soon as the
> context is freed.
> - Felix
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
More information about the openwrt-devel