Running asynchronous agents on the Domino® server
To enable multiprocessing agents on the server:
- Add the following line to your NOTES.INI file:
DominoAsynchronizeAgents=1
- Restart your HTTP server.
Note: Enabling multiprocessing is not the same as increasing
the number of agent managers.
Thread-safe LSX, C/C++ code
Notes® is thread-safe. To write multithreaded agents, you must make sure your LSX or C/C++ code is thread-safe.
Thread-safe code means one of the following:
- The code shares no resources with other execution threads.
- The code shares resources with other execution threads but locks prevent concurrent access.
To design thread-safe code:
- Use only stack-allocated and dynamically-allocated memory in C or C++, such as, function/method local or calloc/malloc/new.
- Do not pass pointers between threads.
- If you must use static declarations, module level variables, or pass pointers, use locks.
Thread-specific bugs
Threading problems are usually non-deterministic.
Common threading problems include:
- Lost updates
- Partial updates
- Deadlock
- Thread calls non-thread-safe code
Creating and destroying locks
To create locks, use the command:
LockID=CreateLock( LockName as String)
This command creates a link to the specified lock and returns the lock ID used by other lock primitives. It creates a lock if one doesn't exist.
To remove locks, use the command
DestroyLock ( LockID as Integer)
This command removes the current link to the lock specified and destroys the lock if no links remain.