Reply to post: Async callbacks are used even for multi-threaded code..

'Microsoft Office has been the bane of my life, while simultaneously keeping me employed'

Lysenko

Async callbacks are used even for multi-threaded code..

Yes. That's I/O completion ports and WaitForMultipleObjects() etc. since we're talking Windows. I was discussing the approach in the context of single threaded scripting languages (JS, VBA) and/or operating systems (Win16).

As for anti-pattern: I agree if one defines "scalable" to mean "web scale", but there are other games in town. If you have an industrial control system communicating with 8 gizmos it may be that the only scaling physically possible within the factory is 32 gizmos and persistent state with deterministic timing is everything (Robotics, for example).

In such cases one thread per peer is perfectly valid and eliminates some timing and race condition traps that an async/state machine/thread pool approach needs to code around with sync objects. Global locks to transfer a state object between threads are expensive, for example.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon