On Wednesday 18 February 2015 08:15:40 Lankswert, Patrick wrote:
> Ok, we all agree that threaded, re-entrant code is good. Deadlocks are bad.
> Clear locking order is good....
>
> Can we get to some code? Can you provide concrete examples of these issues
> and a suggestion for something better. Let's get our hands dirty.
Hi Pat
This part of the discussion was theoretical. I don't have any examples of code
that deadlocks.
My goal is to start hacking away at the C SDK and start providing a reentrant
option. A simple plan that comes to mind is as follows:
1) create an ITVTContext struct
2) move all global variables to the context
3) begin duplicating the current API with calls that take the context as a
parameter, while making the current API use a global, shared ITVTContext
4) deprecate and later remove the old non-context API.
Note on 3: this also gives us the opportunity to apply our naming change
without breaking existing codebase.
Note on 4: we can opt to keep the context-less API as a convenience.
Of course, no plan survives contact with the enemy, so I'm pretty sure it
won't be as simple as I suggested.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 173 bytes
Desc: This is a digitally signed message part.
URL:
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20150218/3b34c86d/attachment.sig>