void LpelWorkerDestroyStream(workerctx_t *wc) { lpel_stream_t *head = wc->free_stream; lpel_stream_t *tmp; while (head != NULL) { tmp = head->next; LpelStreamDestroy(head); head = tmp; } }
/** * Close a stream previously opened for reading/writing * * @param sd stream descriptor * @param destroy_s if != 0, destroy the stream as well */ void LpelStreamClose( lpel_stream_desc_t *sd, int destroy_s) { /* MONITORING CALLBACK */ #ifdef USE_TASK_EVENT_LOGGING if (sd->mon && MON_CB(stream_close)) { MON_CB(stream_close)(sd->mon); } #endif if (destroy_s) { LpelStreamDestroy( sd->stream); } free(sd); }
/** * Replace a stream opened for reading by another stream * Destroys old stream. * * @param sd stream descriptor for which the stream must be replaced * @param snew the new stream * @pre snew must not be opened by same or other task */ void LpelStreamReplace( lpel_stream_desc_t *sd, lpel_stream_t *snew) { assert( sd->mode == 'r'); /* destroy old stream */ LpelStreamDestroy( sd->stream); /* assign new stream */ sd->stream = snew; /* new consumer sd of stream */ sd->stream->cons_sd = sd; /* MONITORING CALLBACK */ #ifdef USE_TASK_EVENT_LOGGING if (sd->mon && MON_CB(stream_replace)) { MON_CB(stream_replace)(sd->mon, snew->uid); } #endif }
void SNetStreamDestroy(snet_stream_t *s) { return LpelStreamDestroy( (struct lpel_stream_t *) s); }