--- l2_stream.c 2001/09/12 09:42:34 1.15
+++ l2_stream.c 2001/09/12 13:50:46 1.16
@@ -43,6 +43,7 @@
/* initialize stream structure */
st->levelmask = 0;
+ st->flushmask = 0;
for (i = 0; i < L2_MAX_CHANNELS; i++)
st->channels[i].ch = NULL;
for (i = 0; i < L2_MAX_FORMATTERS; i++)
@@ -52,7 +53,7 @@
}
/* attach channel to stream */
-l2_result_t l2_stream_channel(l2_stream_t *st, l2_channel_t *ch, unsigned int levelmask)
+l2_result_t l2_stream_channel(l2_stream_t *st, l2_channel_t *ch, unsigned int levelmask, unsigned int flushmask)
{
l2_channel_t *chC;
l2_channel_t *chN;
@@ -79,6 +80,7 @@
/* attach channel to stream */
st->channels[i].ch = ch;
st->channels[i].levelmask = levelmask;
+ st->channels[i].flushmask = flushmask;
return L2_OK;
}
@@ -107,7 +109,7 @@
}
/* set stream level mask */
-l2_result_t l2_stream_levels(l2_stream_t *st, unsigned int levelmask)
+l2_result_t l2_stream_levels(l2_stream_t *st, unsigned int levelmask, unsigned int flushmask)
{
/* argument sanity check */
if (st == NULL)
@@ -115,6 +117,7 @@
/* override global level mask */
st->levelmask = levelmask;
+ st->flushmask = flushmask;
return L2_OK;
}
@@ -225,6 +228,9 @@
if (st->channels[i].levelmask & level) {
if ((rv = l2_channel_write(st->channels[i].ch, level, st->message, len)) != L2_OK)
break;
+ if ((st->flushmask & level) || (st->channels[i].flushmask & level))
+ if ((rv = l2_channel_flush(st->channels[i].ch)) != L2_OK)
+ break;
}
}
return rv;
|