QLock(3qt)

NAME
QLock - Wrapper round a System V shared semaphore

SYNOPSIS
#include <qlock_qws.h>

  Public Members
QLock ( const QString & filename, char id, bool create = FALSE )
~QLock ()
enum Type { Read, Write }
bool isValid () const
void lock ( Type t )
void unlock ()
bool locked () const

DESCRIPTION
The QLock class is a wrapper round a System V shared semaphore.

It is used by Qt/Embedded for synchronizing access to the graphics card and shared memory region between processes.

See also Input/Output and Networking and Qt/Embedded.

  Member Type Documentation

QLock::Type

QLock::Read

QLock::Write

MEMBER FUNCTION DOCUMENTATION

QLock::QLock ( const QString & filename, char id, bool create = FALSE )
Creates a lock. filename is the file path of the Unix-domain socket the Qt/Embedded client is using. id is the name of the particular lock to be created on that socket. If create is TRUE the lock is to be created (as the Qt/Embedded server does); if create is FALSE the lock should exist already (as the Qt/Embedded client expects).

QLock::~QLock ()
Destroys a lock

bool QLock::isValid () const
Returns TRUE if the lock constructor was succesful; returns FALSE if the lock could not be created or was not available to connect to.

void QLock::lock ( Type t )
Locks the semaphore with a lock of type t. Locks can either be Read or Write. If a lock is Read, attempts to lock by other processes as Read will succeed, Write attempts will block until the lock is unlocked. If locked as Write, all attempts to lock by other processes will block until the lock is unlocked. Locks are stacked: i.e. a given QLock can be locked multiple times by the same process without blocking, and will only be unlocked after a corresponding number of unlock() calls.

bool QLock::locked () const
Returns TRUE if the lock is currently held by the current process; otherwise returns FALSE.

void QLock::unlock ()
Unlocks the semaphore. If other processes were blocking waiting to lock() the semaphore, one of them will wake up and succeed in lock()ing.

SEE ALSO
http://doc.trolltech.com/qlock.html http://www.trolltech.com/faq/tech.html

COPYRIGHT
Copyright 1992-2001 Trolltech AS, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.

AUTHOR
Generated automatically from the source code.

BUGS
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you.

The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.

If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qlock.3qt) and the Qt version (3.0.3).