Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of C027_Support_New by
Diff: Pipe.h
- Revision:
- 74:208e3e32d263
- Parent:
- 41:b94a1f410e71
- Child:
- 75:ce6e12067d0c
--- a/Pipe.h Thu May 15 08:25:45 2014 +0000
+++ b/Pipe.h Thu May 15 22:20:42 2014 +0000
@@ -15,7 +15,7 @@
*/
Pipe(int n, T* b = NULL)
{
- _a = b ? NULL : new T[n];
+ _a = b ? NULL : n ? new T[n] : NULL;
_r = 0;
_w = 0;
_b = b ? b : _a;
@@ -98,7 +98,7 @@
for (;;) // wait for space
{
f = free();
- if (f) break; // data avail
+ if (f > 0) break; // data avail
if (!t) return n - c; // no more space and not blocking
}
// check free space
