![]() Zrix is a premium service provider of custom ticketing software development solutions worldwide for. Abstracted away from the developer, this is all handled by a library called libuv which provides a mechanism called an event loop. A transaction passing through Node traverses a cascade of callbacks. As we did above, when a listener is registered using the emitter. ![]() So what we do is place the event on a queue in a thread-safe manner. Increase Ticket Sales With Ticketing Software And Apps. This means that everything that happens in Node is the reaction to an event. It's not safe to just call the JS function from the thread where the native event happened for the same reasons that you'd encounter in a regular multi-threaded application – race conditions, non-atomic memory access, and so forth. So when there's data available on a socket or a native API function has returned, we need a synchronized way to invoke the JavaScript function that is interested in the particular event that just happened. ![]() Remember that while JavaScript is single-threaded, all of node's I/O and calls to native APIs are either asynchronous (using platform-specific mechanisms), or run on a separate thread. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |