Permalink
Browse files

Ref/Mutex: Write reference page for Mutex.

  • Loading branch information...
1 parent 1400fc1 commit 2a3b66adc6d16232b8c0a6d844d9217beb21cbdb @runpaint committed Jan 18, 2011
Showing with 23 additions and 0 deletions.
  1. +1 −0 book.xml
  2. +22 −0 src/ref/mutex.xml
View
@@ -72,6 +72,7 @@
<xi:include href="src/ref/math.xml"/>
<xi:include href="src/ref/method.xml"/>
<xi:include href="src/ref/module.xml"/>
+ <xi:include href="src/ref/mutex.xml"/>
</part>
<xi:include href="src/bibliography.xml"/>
View
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<appendix version="5.0"
+ xml:id="ref.mutex" xml:lang="en" xmlns="http://docbook.org/ns/docbook"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+
+ <title>Mutex</title>
+
+ <para><methodsynopsis><type>Mutex</type><methodname>Mutex.new</methodname><void/></methodsynopsis> Creates and returns a new <literal>Mutex</literal>.</para>
+
+ <para><methodsynopsis><type>Mutex</type><methodname>Mutex#lock</methodname><void/></methodsynopsis> Tries to place a lock on this mutex. If already locked by another thread, blocks until the lock has been removed; if locked by the current thread, raises a <exceptionname>ThreadError</exceptionname>.</para>
+
+ <para><methodsynopsis><type>true or false</type><methodname>Mutex#locked?</methodname><void/></methodsynopsis> Returns <literal>true</literal> if this mutex is locked; otherwise, <literal>false</literal>.</para>
+
+ <para><methodsynopsis><type>Integer</type><methodname>Mutex#sleep</methodname><methodparam choice="opt"><parameter>duration=nil</parameter></methodparam></methodsynopsis> Unlocks this mutex, sleeps for <parameter>duration</parameter> seconds, re-locks this mutex, then returns the number of seconds slept. If <parameter>duration</parameter> is <literal>nil</literal>, sleeps forever.</para>
+
+ <para><methodsynopsis><type>Object</type><methodname>Mutex#synchronize</methodname><methodparam><parameter>{ }</parameter></methodparam></methodsynopsis> Locks this mutex, yields to the block, releases the lock, then returns the value of the block.</para>
+
+ <para><methodsynopsis><type>true or false</type><methodname>Mutex#try_lock</methodname><void/></methodsynopsis> Tries to place a lock on this mutex without blocking: if it is unlocked, locks it, then returns <literal>true</literal>; otherwise, returns <literal>false</literal>.</para>
+
+ <para><methodsynopsis><type>Mutex</type><methodname>Mutex#unlock</methodname><void/></methodsynopsis> Releases the current thread’s lock on this mutex.</para>
+</appendix>

0 comments on commit 2a3b66a

Please sign in to comment.