-
Notifications
You must be signed in to change notification settings - Fork 123
kdb high-level API: global mode #1378
Comments
Another alternative would be to provide two convenience-functions like |
Yes, this would make the feature more explicit. But maybe we implement such two functions within lcdproc? (They are really trivial) |
We should not use We could also have some ELEKTRA_INSTANCE`, but it makes the names really long:
|
@tom-wa Can you check if we are able to pass a handle to every place where config is needed in lcdproc? Maybe there is no need for a "global mode" anyway. |
usually i avoid global variables but lcdproc uses a global variable and i would keep it that way (at least for now). |
So it is not easily possible to pass the handle to everywhere needed?
The handle is definitely the better option (future-proof, e.g. if they want to introduce multi-threading), so if there is a way to do it with handle, we do not have to bother them about that question. In particular, we have too many variables:
We need to reduce the number of variants, ideally to code generation yes/no as only option for them. Otherwise inconsistent use of our APIs will creep into their code base. |
For the server part it's easy, you just need to pass it, for some clients it seems like theres a bit more to change. |
Which are the problematic clients? We could also add a global variable only in clients where the change wouldn't be easy. |
not needed -> rejected |
While I am against using globals at all, I see that many applications do not care and prefer a simpler API.
For the high-level API we could add an optional global mode, whenever the user passes
0
instead of the handle. For example:Drawback: On multi-threading this obviously wont work and we would even produce race conditions if
kdbhlOpen
is used concurrently.Alternative:
@tom-wa @domhof What do you think?
The text was updated successfully, but these errors were encountered: