VB中的SyncLock
来源:互联网 发布:分屏 源码 编辑:程序博客网 时间:2024/05/17 03:14
Allows statements to be synchronized on a single expression.
SyncLock expression...[ block ]End SyncLock
Parts
- expression
- Required. A unique collection of operators and values that yield a single result.
- block
- Optional. The statements that will execute in sequence.
- End SyncLock
- Terminates a SyncLock procedure.
Remarks
The SyncLock statement ensures that multiple threads do not execute the same statements at the same time. When the thread reaches the SyncLock block, it evaluates the expression and maintains this exclusivity until it has a lock on the object that is returned by the expression. This prevents an expression from changing values during the running of several threads, which can give unexpected results from your code.
Note The type of the expression in a SyncLock statement must be a reference type, such as a class, a module, an interface, array or delegate.
Example
Class Cache Private Shared Sub Add(ByVal x As Object) SyncLock GetType(Cache) End SyncLock End Sub Private Shared Sub Remove(ByVal x As Object) SyncLock GetType(Cache) End SyncLock End SubEnd Class
- VB中的SyncLock
- vb.net 多线程与SyncLock锁
- SyncLock语句
- SyncLock 语句
- SyncLock GetType(Sum) '定义独占锁
- [Thread] 執行緒同步資源鎖定 – lock / SyncLock
- VB中的数据结构使用
- VB中的Winsock编程
- VB中的GDI对象
- vb.net中的数据库连接
- vb.net中的数据库连接
- vb.net 中的短路
- vb编程中的DoEvent
- VB中的类开发
- VB中的托盘图标
- VB.NET中的App
- VB中的多线程
- VB中的EXPLICT
- PFC入门
- These are the characters that can be directly encoded in UTF7...
- 2005年9月20日(月记)
- 求救:怎样获得前一天的日期??
- 今天体验了一把MOBILE!
- VB中的SyncLock
- Grup如何进入单用户模式
- 在debian中使用apt工具(二)
- 论坛的七宗罪(三)
- 用C#访问HotMail
- 小小PM的生活
- Blowfish
- redhat9忘记密码总结
- 如何将 BPEL process 运行在 ServiceMix JBI Container 和 Fivesight's PXE上