?? cwp3754.htm
字號:
<!-- saved from url=(0007)http:// -->
<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><TITLE>Perst.IResource</TITLE><LINK REL=STYLESHEET HREF="../CommentReport.css" TYPE="text/css"></HEAD><BODY topmargin=0 rightmargin=0 leftmargin=0 style="background-image: url(../titletile.jpg); background-repeat:repeat-x; background-position: 0 0;" ><DIV CLASS="PageHeading">Perst.IResource Interface</DIV><DIV CLASS="Description">
Interface of object supporting locking
<P></DIV><IMG src="../GradLeft.jpg" width=7 height=378 alt="" border="0" style="position:absolute; left:10; top:18;z-Index:2"><IMG src="../GradTop.jpg" width=352 height=7 alt="" border="0" align="top" style="position:absolute; left:10; top:18; z-index:1"><DIV CLASS="Remarks"><SPAN CLASS="RemarkHdrX">Access: </SPAN>Public</DIV><TABLE CLASS="InfoTable" cellpadding=0 cellspacing=0><TR height=20><TD width=20> </TD><TD valign=top align=left width=9 bgcolor="#cccc66"><IMG SRC="../graycorner.jpg" align=top></TD><TD CLASS="TableLightLabel" WIDTH=206>Members</TD><TD CLASS="TableLightLabel" >Description</TD><TD width=20> </TD></TR><TR height=20><TD width=20> </TD><TD CLASS="TableLightDesc"> </TD><TD CLASS="TableLightDesc"><A HREF="CWP3755.HTM" TARGET="CNTFRAME">SharedLock</A></TD><TD CLASS="TableLightDesc">
Lock persistent object in shared mode. Other threads will be able to set their
shared locks on this objects, but not exclusive lock can be set until this lock is released.
Upgrading of the lock is not possible (thread having read lock can not upgrade it to exclusive lock).
It is done to prevent possible deadlocks caused by lock updates.
But locks are reentrant - so thread can request the same lock many times (and correspondent
number of unlocks is needed to release the lock).
Locking the object doesn't prevent other threads from accessing the object -
it only has influence on <code>sharedLock</code> and <code>exclusiveLock</code> methods.
So programmer should set proper lock before accessing the object in multithreaded application.
If object is concurrently accessed by several threads in read-only mode, then explicit locking
of this object is not needed, because language API provides consistent retrieving of objects itself.
Only persistent object (object which were assigned to the the storage either implicitly by
saving some other persistent object referencing this object, either explicitly by
<code>Storage.makeObjectPersistent</code> method.
<P></TD><TD width=20> </TD></TR><TR height=20><TD width=20> </TD><TD CLASS="TableLightDesc"> </TD><TD CLASS="TableLightDesc"><A HREF="CWP3756.HTM" TARGET="CNTFRAME">ExclusiveLock</A></TD><TD CLASS="TableLightDesc">
Lock persistent object in exclusive mode. Only one thread can lock object in exclusive mode at each
moment of time. Shared or exclusive lock requests of other threads will be blocked until
this lock is released.
shared locks on this objects, but not exclusive lock can be set until this lock is released.
This lock is reentrant, so thread owning the lock can successfully retrieve the lock many times
(and correspondent number of unlocks is needed to release the lock).
Locking the object doesn't prevent other threads from accessing the object -
it only has influence on <code>sharedLock</code> and <code>exclusiveLock</code> methods.
So programmer should set proper lock before accessing the object in multithreaded application.
Only persistent object (object which were assigned to the the storage either implicitly by
saving some other persistent object referencing this object, either explicitly by
<code>Storage.makeObjectPersistent</code> method.
<P></TD><TD width=20> </TD></TR><TR height=20><TD width=20> </TD><TD CLASS="TableLightDesc"> </TD><TD CLASS="TableLightDesc"><A HREF="CWP3757.HTM" TARGET="CNTFRAME">SharedLock</A></TD><TD CLASS="TableLightDesc">
Lock persistent object in shared mode. Other threads will be able to set their
shared locks on this objects, but not exclusive lock can be set until this lock is released.
Upgrading of the lock is not possible (thread having read lock can not upgrade it to exclusive lock).
It is done to prevent possible deadlocks caused by lock updates.
But locks are reentrant - so thread can request the same lock many times (and correspondent
number of unlocks is needed to release the lock).
Locking the object doesn't prevent other threads from accessing the object -
it only has influence on <code>sharedLock</code> and <code>exclusiveLock</code> methods.
So programmer should set proper lock before accessing the object in multithreaded application.
If object is concurrently accessed by several threads in read-only mode, then explicit locking
of this object is not needed, because language API provides consistent retrieving of objects itself.
Only persistent object (object which were assigned to the the storage either implicitly by
saving some other persistent object referencing this object, either explicitly by
<code>Storage.makeObjectPersistent</code> method.
<P></TD><TD width=20> </TD></TR><TR height=20><TD width=20> </TD><TD CLASS="TableLightDesc"> </TD><TD CLASS="TableLightDesc"><A HREF="CWP3758.HTM" TARGET="CNTFRAME">ExclusiveLock</A></TD><TD CLASS="TableLightDesc">
Lock persistent object in exclusive mode. Only one thread can lock object in exclusive mode at each
moment of time. Shared or exclusive lock requests of other threads will be blocked until
this lock is released.
shared locks on this objects, but not exclusive lock can be set until this lock is released.
This lock is reentrant, so thread owning the lock can successfully retrieve the lock many times
(and correspondent number of unlocks is needed to release the lock).
Locking the object doesn't prevent other threads from accessing the object -
it only has influence on <code>sharedLock</code> and <code>exclusiveLock</code> methods.
So programmer should set proper lock before accessing the object in multithreaded application.
Only persistent object (object which were assigned to the the storage either implicitly by
saving some other persistent object referencing this object, either explicitly by
<code>Storage.makeObjectPersistent</code> method.
<P></TD><TD width=20> </TD></TR><TR height=20><TD width=20> </TD><TD CLASS="TableLightDesc"> </TD><TD CLASS="TableLightDesc"><A HREF="CWP3759.HTM" TARGET="CNTFRAME">Unlock</A></TD><TD CLASS="TableLightDesc">
Remove granted lock. If lock was requested several times by one thread, then correspondent number
of unlocks is needed to release the lock.
<P></TD><TD width=20> </TD></TR><TR height=20><TD width=20> </TD><TD CLASS="TableLightDesc"> </TD><TD CLASS="TableLightDesc"><A HREF="CWP3760.HTM" TARGET="CNTFRAME">Reset</A></TD><TD CLASS="TableLightDesc">
Reset resource to original state.
Wakrup all threads waiting for this resource.
<P></TD><TD width=20> </TD></TR></TABLE></BODY></HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -