You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the error feedback is done through a global variable. This is very hostile towards multi-threading.
Instead, create a struct which keeps state for the current thread. This struct should also contain the socket cache. Applications would have to pass an instance of this struct to the API by reference.
This makes it easier to keep track of state, and applications can use libifconfig in a multithreaded way even though libifconfig is not aware of threading, so long as they use a separate instance of the state struct per thread.
Idea by: Adrian Chadd
The text was updated successfully, but these errors were encountered:
libifc_handle_t* libifc_open();
void libifc_close(libifc_handle_t *h);
int libifc_set_mtu(libifc_handle_t *h, const char *name, int mtu);
…
Possibly also: int libifc_get_error(libifc_handle_t *h);
If the definition of libifc_handle_t is kept opaque (so the headers only have ‘struct libifc_handle; typedef struct libifc_handle libifc_handle_t;’) you can get away with changing the size or contents of the struct without breaking any of the users.
(Because they’ll only have a pointer to keep track of, the size of the object it points to doesn’t matter to them.)
Currently, the error feedback is done through a global variable. This is very hostile towards multi-threading.
Instead, create a struct which keeps state for the current thread. This struct should also contain the socket cache. Applications would have to pass an instance of this struct to the API by reference.
This makes it easier to keep track of state, and applications can use libifconfig in a multithreaded way even though libifconfig is not aware of threading, so long as they use a separate instance of the state struct per thread.
Idea by: Adrian Chadd
The text was updated successfully, but these errors were encountered: