LogoLogo
HomeNewsSupportVideos
  • Introduction
  • Getting Started
  • What's new in 4.0
    • Known Issues
    • .NET Core Designer
    • Managed Graphics
    • Fluent Markup
    • Markdown Support
    • Upgrade from 3.x
  • Releases
    • What's new in 4.0
    • What's new in 3.5
    • What's new in 3.2
      • View Builder
      • Validation Rules
      • Enhanced Font Support
      • Design-Time Debug
    • What's new in 3.1
    • What's new in 3.0
      • FAQs
      • Update Existing Projects
      • Multi Targeting
      • Visual Studio Designer
      • Referencing Assemblies
      • Docker Support
      • Troubleshooting
      • Deployment
    • What's new in 2.5
    • What's new in 2.2
    • What's new in 2.1
    • What's new in 2.0
    • Upgrade from 1.x
  • Getting Started
    • New Project
    • Templates
    • Troubleshooting
    • License Activation
    • FAQ
    • API
    • Hybrid
    • Deployment
    • Theme Builder
  • Concepts
    • Startup
    • Configuration
    • Load Balancing
    • Designer
    • Layouts
    • Client Profiles
    • Tab Order
    • Compression
    • Embedded Resources
    • Modal Workflow
    • Localization
    • RightToLeft
    • Background Tasks
    • Real Time Web Applications
    • JavaScript
    • JavaScript Object Model
    • Security
    • Synchronization
    • Session Management
    • Theming
    • Dependency Injection
    • Application Switches
    • Visual Studio Code
  • Controls & Components
    • General
      • Application
      • AutoSizing
      • AutoScroll
      • AutoScaling
      • Accessibility
      • Colors & Fonts
      • Embedded Tools
      • Events
      • Touch Events
      • Images
      • Labels
      • ToolTips
      • Data Binding
      • Common Properties
      • Custom Painting
      • Move & Resize
      • Drag & Drop
      • Validation
      • User Data
      • Responsive Properties
      • VB.NET Extensions
    • Common Dialogs
      • FolderBrowserDialog
      • ColorDialog
      • OpenFileDialog
      • SaveFileDialog
    • Editors
      • TextBox
        • TagTextBox
        • MaskedTextBox
        • TypedTextBox
      • DateTimePicker
      • MonthCalendar
      • TimeUpDown
      • DomainUpDown
      • NumericUpDown
      • TrackBar
    • Buttons
      • Button
      • SplitButton
      • CheckBox
      • RadioButton
    • Containers
      • Page
      • Form
      • Desktop
      • Panel
      • FlexLayoutPanel
      • FlowLayoutPanel
      • TableLayoutPanel
      • GroupBox
      • Accordion
      • TabControl
      • UserPopup
      • UserControl
      • ToolBar
      • StatusBar
      • SplitContainer
      • SlideBar
    • Lists & Grids
      • ComboBox
        • UserComboBox
        • TreeViewComboBox
        • ListViewComboBox
      • ListBox
        • CheckedListBox
      • TreeView
      • ListView
      • DataGridView
        • Column
        • TextBoxColumn
        • ButtonColumn
        • LinkColumn
        • ImageColumn
        • MaskedTextBoxColumn
        • DateTimePickerColumn
        • NumericUpDownColumn
        • CheckBoxColumn
        • ComboBoxColumn
      • DataRepeater
      • PropertyGrid
    • Extenders
      • Animation
      • ToolTip
      • ErrorProvider
      • Rotation
      • StyleSheet
      • JavaScript
    • Media
      • Audio
      • Video
      • FlashPlayer
    • Content
      • Label
      • LinkLabel
      • PictureBox
      • ScrollBars
      • Upload
      • AspNetPanel
      • ImageList
      • PdfViewer
      • ProgressBar
      • Spacer
      • Widget
      • WebBrowser
      • IFramePanel
      • HtmlPanel
      • Canvas
      • Shape
      • Line
    • Menus
      • MainMenu
      • MenuBar
      • MenuItem
      • LinkMenuItem
      • ContextMenu
    • Notifications
      • AlertBox
      • MessageBox
      • Toast
    • Other Components
      • Timer
      • BindingSource
      • BindingNavigator
      • DataSet
      • EventLog
      • MessageQueue
      • PerformanceCounter
Powered by GitBook
On this page
  • Synchronization Pattern
  • Fair Locking
  • Background Tasks

Was this helpful?

Export as PDF
  1. Concepts

Synchronization

Thread synchronization is very important in Wisej.NET due to its Real-Time nature and the small frequent WebSocket communication with the server. Understanding the basics of Wisej.NET synchronization helps when dealing with long-running actions, or parallel background tasks that need to interact with the user interface.

Synchronization Pattern

All events from the client are synchronized. Wisej.NET will always execute only one client event at a time in the order they are received from the client.

If the server takes a long time to process an event, the client may show a gif loader mask blocking the user from interacting with the application. The timing, loader image, and other properties are configurable in Default.json and in the theme.

Refresh requests are not synchronized with the session and are processed in parallel. The user can refresh the browser while the server is processing an event and reload the page at any time.

Data loading requests (DataGrid pulling rows, ListView pulling items) are not synchronized with the session and are processed in parallel. However, they need to lock the collection they are rendering. This feature allows a user to refresh the browser while the server is processing an action and receive back the entire application.

All collections in Wisej.NET are now synchronized at the collection level. It's the tightest possible locking and avoids any possibility of deadlocks since there are no external events in the locked blocks.

Background tasks that need to alter a collection of components owned by a control (i.e. Rows, Items, Child Controls, etc.) may lock the collection itself. Wisej.NET uses the collection instance as the SyncRoot object.

Fair Locking

Usually thread locks are not guaranteed by the OS to be released in the order they are acquired.

Wisej.NET uses a special implementation of the "Fair Locking" pattern to guarantee that the threads are released in the order they are received and that if a component is disposed while waiting for the server to process its events the execution is aborted.

Background Tasks

If your application runs background tasks that interact with UI controls, remember to check if the control has been disposed and lock the collections you are manipulating. If the user closes the application or the parent of a control, the control is disposed and your background task may generate an exception.

In general, the synchronization of your application is entirely up to you, like in any other system. Wisej.NET can only guarantee the synchronization of its internal functions.

PreviousSecurityNextSession Management

Last updated 3 months ago

Was this helpful?