Background I have a program written in C++ that takes as input several TCP/IP ports where data is transmitted. Each entity transmitted contains a timestamp that is local to the computer transmitting. There is however a synch entity that will show up at the same time in each transmitter. The task is to sort the incoming entities according to a global clock.
The C++ program is written in a way which is single-threaded, it stores entities in circular buffers, one buffer for each transmitter, and when a synch entity arrives, it is checked if it has arrived in each transmitter, then the local times are transformed into a global time, and the entities are taken from the buffers so they appear sorted. As you can imagine, a lot of edge cases exist, and the program has become a mess.
Current problem Now I have tried to implement a solution in Nimrod using threads and channels. This has worked out really nicely, and the program is much shorter and concise. I have a test thread in the Nimrod program which injects entities as coming from two concurrent transmitters. This means the sockets library is used as transmitter in one thread and as receiver in another thread and then there are several other threads implementing the algorithm. Nimrod compiler warns about concurrent threads when compiling on Windows, and the program does crash. On Linux, no warning and the program runs fine. Is this a known problem? Is there any workaround?