EMan (see Chapter 9 on "The Event Management Framework") is not a replacement for threads, but it supports processing of asynchronous requests. EMan allows a program to handle events from multiple input sources; but the handlers run on a single thread, under control of EMan's main loop.
DSOM provides a runtime function, SOMD_RegisterCallback, which is used by DSOM to associate user-supplied event handlers with DSOM's communications sockets and message queues with EMan. Example code is shown below.
DSOM server programs which use EMan must be very careful not to get into deadlock situations. This is quite easy to do with DSOM, since method calls are synchronous. If two cooperating processes simultaneously make calls on each other, a deadlock could result. Likewise, if a method call on remote object B from A requires a method call back to A, a deadlock cycle will exist. (Of course, the number of processes and objects which create the cyclic dependency could be greater than two.)
The application developer must be careful to avoid situations where cooperating processes are likely to make calls upon each other, creating a cyclic dependency. Some applications may find it appropriate to use oneway messages to avoid deadlock cycles, since oneway messages do not cause a process to block. It may also be possible for an application to defer the actual processing of a method that may "call back" an originating process, by scheduling work using EMan client events.