nodejs / http-parser

http request/response parser for c
MIT License
6.32k stars 1.53k forks source link

how does the http-parser to support the multi threads #498

Closed darmenliu closed 4 years ago

darmenliu commented 4 years ago

hi, I have a sence that client send the big data request, then server will use multi thread to process the request, these threads might invoke parser parallel, I'm not sure hao do I support the multi threads via http-parser.

bnoordhuis commented 4 years ago

http-parser is oblivious to threads. As long as there's only one thread at a time operating on the struct http_parser instance and provided you issue the proper memory barrier when passing the struct between threads, everything is fine.