Contains possible values for synchronization modes used in Graphics Mill for .NET.
Namespace:
Aurigma.GraphicsMill
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
Public Enumeration SynchronizationMode
public enum SynchronizationMode
Member name | Description | |
---|---|---|
AsyncViaMessageLoop |
Asynchronous mode which uses thread message loop (window procedure). Operation is run in auxiliary thread, events are fired in main thread. This is an asynchronous mode which executes the operation in auxilary thread, but call event handlers in main application thread. This is a crucial difference from Async mode. All event handlers are automatically thread safe, in particular it makes using standard controls like progress bar easy. However this method is not perfect too. You should write event handlers carefully and avoid deadlocks, otherwise your application will hang. Deadlock may happen when you get access to the bitmap or other object which has been locked. You can check it with property Locked. Also you may avoid hanging with a help of Timeout property. However deadlock means a flaw in your code logic, so anyway you must avoid it. Also, AsyncViaMessageLoop has a limitation - it works only at applications which have GUI. So if you need an asynchronous mode in console applications, ASP.NET, etc, you should use Async instead. |
|
Async |
Asynchronous mode. Operation is run in auxiliary thread, most events are fired in auxiliary thread too. In asynchronous mode the operation is not running in the same thread with main application. Therefore user interface is not freezing, user can use your application while operation is done. He can abort, pause or continue the operation. Note, when events are fired, their handlers a run in auxilary thread. That's why you must provide thread safety for these handlers. If event handler and main application thread are modifying the same object or memory, the result is unpredictable (usually it just crashes unexpectedly). |
|
Sync |
Synchronous mode. Operation is run in main thread of application. This mode is simple in usage and always used by default. The shortcoming of this method is that user interface freezes while operation is applied. If you need to run the operation in the background, you should use some of asynchronous mode. |