Home > Back-end >  A few threads are sending data to the same thread, have what good method?
A few threads are sending data to the same thread, have what good method?

Time:09-21

Several TCP threads, receives the data after the data is sent to another thread processing, every time to send the amount of data about 50 bytes, news communication is used to complete at present, there is no better solution, please grant instruction!!!!!!
Want to switch to pipe, pipe do not know whether or not to have more than one write end, there are other ways please recommend,

CodePudding user response:

Oneself write a queue, lock can also

CodePudding user response:

reference 1st floor pcwe2002 response:
oneself write a queue, lock can also

Just think this way too the soil!

CodePudding user response:

The mapping file
Create a memory mapped file, each thread assigned 256 bytes, then build an EVENT object for each thread

CodePudding user response:

reference 1st floor pcwe2002 response:
oneself write a queue, lock can also


Want to make more complicated?
Simple is practical,

CodePudding user response:

refer to the second floor AAAA987506002 response:
Quote: refer to 1st floor pcwe2002 response:

Oneself write a queue, lock can also

Just think this way too the soil!


Suggest using this method, namely the queue lock
  • Related