Important
The end flag of input stream should be initialized, otherwise it may cause deadlock in output stream. The input strteam of Merge Sort primitive should be pre-sorted stream.
Caution
If the two input stream are both empty, the function output will be also empty.
This mergeSort
primitive has two port for key input, two port for payload input, one port for merged key output, one port for merged payload output and one boolean sign for indicating ascending sort or descending sort.