notepad::CSemaphore Class Reference

#include <notepad_commandqueue.h>

Public Member Functions

 CSemaphore ()
 CSemaphore (gint v)
 ~CSemaphore ()
void p ()
void v ()
bool try_p ()
void set (unsigned int n)

Detailed Description

Definition at line 72 of file notepad_commandqueue.h.


Constructor & Destructor Documentation

notepad::CSemaphore::CSemaphore (  )  [inline]

Definition at line 75 of file notepad_commandqueue.h.

00075 :s(0) { m = g_mutex_new(); c = g_cond_new(); };

notepad::CSemaphore::CSemaphore ( gint  v  )  [inline]

Definition at line 76 of file notepad_commandqueue.h.

00076 :s(v) { m = g_mutex_new(); c = g_cond_new(); };

notepad::CSemaphore::~CSemaphore (  )  [inline]

Definition at line 77 of file notepad_commandqueue.h.

00077 { g_mutex_free(m); m=0; g_cond_free(c); c=0; };


Member Function Documentation

void notepad::CSemaphore::p (  )  [inline]

Definition at line 79 of file notepad_commandqueue.h.

Referenced by notepad::CNotepadPages::delete_page(), notepad::CNotepadPages::execRenderPage(), notepad::CNotepadPages::get_page(), and notepad::CNotepadPages::insert_page().

00080             {
00081                 while ( s == 0 ) 
00082                 {
00083                     g_cond_wait(c, m);
00084                 }
00085                 --s;
00086             }

Here is the caller graph for this function:

void notepad::CSemaphore::set ( unsigned int  n  )  [inline]

Definition at line 107 of file notepad_commandqueue.h.

00108             {
00109                 s = n;
00110                 g_cond_signal(c);
00111             }

bool notepad::CSemaphore::try_p (  )  [inline]

Definition at line 95 of file notepad_commandqueue.h.

00096             { 
00097                 bool ret = false;
00098                 GTimeVal tv = {0,1};
00099                 while ( s == 0 ) 
00100                 {
00101                     ret = g_cond_timed_wait(c, m, &tv);
00102                 }
00103                 --s;
00104                 return ret;
00105             }

void notepad::CSemaphore::v (  )  [inline]

Definition at line 88 of file notepad_commandqueue.h.

Referenced by notepad::CmdQueue::add(), notepad::CNotepadPages::delete_page(), notepad::CNotepadPages::execRenderPage(), notepad::CmdQueue::flush(), notepad::CNotepadPages::insert_page(), and notepad::CmdQueue::stop().

00089             {
00090                 ++s;
00091                 g_cond_signal(c);
00092             }

Here is the caller graph for this function:


The documentation for this class was generated from the following file:
Generated by  doxygen 1.6.2-20100208