Remove read and write mutexes since multiple calls to send or multiple
calls to recv on different threads is undefined behavior.
This is because the size of data sent or received by these calls is
undefined and could lead to the data being interleaved. The code now
asserts that there are not multiple threads calling send at the same
or calling recv at the same time. Note that calling send and recv from
different threads at the same time is still safe and well defined
behavior.
By removing the read and write mutexes and associated timeout it
guarantees that a stack call will always be made and thus the value
NSAPI_ERROR_TIMEOUT cannot get falsely returned.
This patch consists of:
-Add NetworkInterface to wrap objects bound to a stack and update
socket code to handle this in addition to NetworkStacks
-Update MeshInterface to inherit from NetworkInterface
-Update NanostackInterface so it only inherits from NetworkStack
-Add MeshInterfaceNanostack and update LoWPANNDInterface and
ThreadInterface to inherit from this
Bytes are stored by default, however enough space is allocated in
a SocketAddress to generate the string representation if necessary.
Currently there is no support for shortened addresses
Pros
- Easier to implement
- More similar to SIGIO in BDS sockets
Cons
- Less information, but this information had a high risk of being
faulty/spurious
Pros
- Simplifies interface
- Easier base implementation
Cons
- May need shutdown functionality, in this case shutdown
can be added as another function in the future
Pros
- Allows memory to be statically allocated
- Avoids issues with Thread creation before entering main
- Matches existing APIs such as FunctionPointer and Ticker
Cons
- Does not enforce passing a NetworkInterface