Reputation: 9914
I am thinking about using Node.js for next project. But I stuck at some point related to thread safety concept. How these issues are addressed(or need to take care) while implementing in Node.js ?
I know JavaScript supports functional programming and this paradigm will address thread-safety. What are best practices to be followed here.
Thanks
Upvotes: 1
Views: 402
Reputation: 3022
Nodejs is single threaded so there will not be thread-safety issue.
Using javascript here because it's easy to write callback, which is the key for non-blocking. You have no control of when the callback will be executed, but you know it will be executed at giving time. In this way, the server will not waste time waiting for io and do more meaningful things.
I strongly suggested you visit http://nodeschool.io/ as a startpoint to learn nodejs.
Upvotes: 2