implemented ThreadedTCPServer, added locks on usage of cross-thread-functions
merged: implemented threadedtcpserver, added locks on cross-thread-funcions