User Tools

Site Tools


mtsummary_of_synchronization_objects_properties_and_methods.htm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

mtsummary_of_synchronization_objects_properties_and_methods.htm [2021/04/15 15:57] – external edit 127.0.0.1mtsummary_of_synchronization_objects_properties_and_methods.htm [2021/11/14 02:42] (current) – Format Code and sections with line dividers carlbarnes
Line 22: Line 22:
 [[mtsummary of synchronization objects properties and methods.htm#mtnewsemaphore|NewSemaphore]] [[mtsummary of synchronization objects properties and methods.htm#mtnewsemaphore|NewSemaphore]]
  
-**GetMutex** +----
- +
-** **+
  
 **GetMutex( **//name//**, <;**//error//**> **) **GetMutex( **//name//**, <;**//error//**> **)
Line 39: Line 37:
 **Example:** **Example:**
  
-**MySem    &amp;IMutex**+<code> 
 +MySem    &IMutex 
 +  CODE 
 +  MySem &= GetMutex('MyApp_RequestServer'
 +  IF MySem &= NULL 
 +    MESSAGE('Server not running'
 +    RETURN(False) 
 +  END 
 +</code>
  
-**   CODE** 
  
-**   MySem &amp;= ****GetMutex****('MyApp_RequestServer')** +----
- +
-**   IF MySem &amp;= NULL** +
- +
-**     MESSAGE('Server not running')** +
- +
-**     RETURN(False)** +
- +
-**   END** +
- +
-**GetSemaphore** +
- +
-** **+
  
 **GetSemaphore( **//name//**, <;**//error//**> **) **GetSemaphore( **//name//**, <;**//error//**> **)
Line 70: Line 63:
 **Example:** **Example:**
  
-**MySem    &amp;ISemaphore**+<code> 
 +MySem    &ISemaphore 
 +  CODE 
 +  MySem &= GetSemaphore('MyApp_RequestServer'
 +  IF MySem &= NULL 
 +      MESSAGE('Server not running'
 +     RETURN(False) 
 +  END 
 +</code>
  
-**   CODE** 
  
-**   MySem &amp;= ****GetSemaphore****('MyApp_RequestServer')** +----
- +
-**   IF MySem &amp;= NULL** +
- +
-**       MESSAGE('Server not running')** +
- +
-**      RETURN(False)** +
- +
-**   END** +
- +
-**NewCriticalSection** +
- +
-** **+
  
 **NewCriticalSection ()** **NewCriticalSection ()**
Line 96: Line 84:
 **Example:** **Example:**
  
-**! This code is invoked for every started thread before call to ThreadProc. **+<code> 
 +! This code is invoked for every started thread before call to ThreadProc.  
 +! Depending on the current thread, Action.Construct executes one of 3  
 +! handler procedures. 
 +  
 +Action.Construct  PROCEDURE() 
 + CODE 
 + SELF.Threadno = THREAD() 
 +  
 + CASE SELF.ThreadNo 
 + OF 1 
 +   Sync &= NewCriticalSection()       ! Create the critical section object 
 +   MainThread &= SELF                 ! Set MainThread to instance of Action 
 +                                      ! for the main thread 
 +   FrameProc (SELF) 
 +   MainThread &= NULL 
 +     Sync.Kill()                      ! Delete the critical section 
 + OF 2 
 +   ToolThread &= SELF                 ! Set ToolThread to instance of Action 
 +                                      ! for the toolbox's thread 
 +   ToolProc (SELF) 
 +   ToolThread &= NULL 
 + ELSE 
 +   ChildProc (SELF) 
 + END 
 + RETURN 
 +</code>
  
-**! Depending on the current thread, Action.Construct executes one of 3 **+----
  
-**! handler procedures.** 
  
-**Action.Construct  PROCEDURE()** +**NewMutex( )**
- +
-**  CODE** +
- +
-**  SELF.Threadno = THREAD()** +
- +
-**  CASE SELF.ThreadNo** +
- +
-**  OF 1** +
- +
-**    Sync &amp;= ****NewCriticalSection()****       ! Create the critical section object** +
- +
-**    MainThread &amp;= SELF                 ! Set MainThread to instance of Action** +
- +
-**                                       ! for the main thread** +
- +
-**    FrameProc (SELF)** +
- +
-**    MainThread &amp;= NULL** +
- +
-**      Sync.Kill()                      ! Delete the critical section** +
- +
-**  OF 2** +
- +
-**    ToolThread &amp;= SELF                 ! Set ToolThread to instance of Action** +
- +
-**                                       ! for the toolbox's thread** +
- +
-**    ToolProc (SELF)** +
- +
-**    ToolThread &amp;= NULL** +
- +
-**  ELSE** +
- +
-**    ChildProc (SELF)** +
- +
-**  END** +
- +
-**  RETURN** +
- +
-**NewMutex** +
- +
-**NewMutex( ),**+
  
 **NewMutex(**//name//, //owner, <;error>//**)** **NewMutex(**//name//, //owner, <;error>//**)**
Line 156: Line 127:
 Returns a reference to a new IMutex. If the Mutex could not be created, a Null value will be returned. Check the //Error// parameter for the reason. (Some reasons for failure can be that another object (e.g., semaphore) exists with the same name, or a different user has created the object (e.g., security error)). Returns a reference to a new IMutex. If the Mutex could not be created, a Null value will be returned. Check the //Error// parameter for the reason. (Some reasons for failure can be that another object (e.g., semaphore) exists with the same name, or a different user has created the object (e.g., security error)).
  
-**NewNamedSemaphore**+----
  
-** ** 
  
 **NewNamedSemaphore (**//name//, //initial//, //max// , <;//error//>** )** **NewNamedSemaphore (**//name//, //initial//, //max// , <;//error//>** )**
- 
-** ** 
  
 | //name// | A string constant or variable that names the new **ISemaphore** object. | | //name// | A string constant or variable that names the new **ISemaphore** object. |
Line 175: Line 143:
 Using the default settings, NewNamedSemaphore will create a semaphore that no threads can wait on until someone calls a Release. Using the default settings, NewNamedSemaphore will create a semaphore that no threads can wait on until someone calls a Release.
  
-**NewReaderWriterLock**+----
  
-** ** 
  
 **NewReaderWriterLock ( ****//WritersHavePriority//****)** **NewReaderWriterLock ( ****//WritersHavePriority//****)**
  
-** ** 
  
 | //WritersHavePriority// | A BYTE variable or constant that sets priority of the Writer. | | //WritersHavePriority// | A BYTE variable or constant that sets priority of the Writer. |
Line 193: Line 159:
 If //WritersHavePriority// is FALSE, all Readers waiting for ownership of the ReaderWriterLock object will take priority over any Writer waiting for ownership. If //WritersHavePriority// is FALSE, all Readers waiting for ownership of the ReaderWriterLock object will take priority over any Writer waiting for ownership.
  
-**NewSemaphore** 
  
-** **+---- 
  
 **NewSemaphore (****// initial//**** , ****//max//****)** **NewSemaphore (****// initial//**** , ****//max//****)**
  
-** ** 
  
 | //Initial// | A LONG variable or constant that indicates the maximum number of threads that can access the semaphore. The default value is zero. | | //Initial// | A LONG variable or constant that indicates the maximum number of threads that can access the semaphore. The default value is zero. |
mtsummary_of_synchronization_objects_properties_and_methods.htm.txt · Last modified: 2021/11/14 02:42 by carlbarnes