kviewshell
GThreads.h File Reference
#include "DjVuGlobal.h"
#include "GException.h"
Go to the source code of this file.
Classes | |
class | GCriticalSection |
class | GCriticalSectionLock |
class | GEvent |
class | GMonitor |
Monitor class. More... | |
class | GMonitorLock |
Wrapper for mutually exclusive code. More... | |
class | GSafeFlags |
A thread safe class representing a set of flags. More... | |
class | GThread |
Thread class. More... | |
Defines | |
GThreads.h | |
Files #"GThreads.h"# and #"GThreads.cpp"# implement common entry points for multithreading on multiple platforms. Each execution thread is represented by an instance of class {GThread}. Synchronization is provided by class {GMonitor} which implements a monitor (C.A.R Hoare, Communications of the ACM, 17(10), 1974). The value of compiler symbol THREADMODEL# selects an appropriate implementation for these classes. The current implementation supports the following values: {description} [-DTHREADMODEL=NOTHREADS] Dummy implementation. This is a good choice when the multithreading features are not required, because it minimizes the portability problems. This is currently the default when compiling under Unix. [-DTHREADMODEL=WINTHREADS] Windows implementation. This is the default when compiling under Windows. [-DTHREADMODEL=MACTHREADS] Macintosh implementation, which is based on the MacOS cooperative model. The current implementation does not yet fully support synchronization. This is the default when compiling under MacOS. [-DTHREADMODEL=POSIXTHREADS] Posix implementation. This implementation also supports DCE threads. The behavior of the code is subject to the quality of the system implementation of Posix threads. [-DTHREADMODEL=COTHREADS] Custom cooperative threads. These custom threads do not redefine system calls. Before executing a potentially blocking system function, each thread must explicitly check whether it is going to block and yield control explicitly if this is the case. This code must be compiled with a patched version of egcs-1.1.1 {http://egcs.cygnus.com}. The patch addresses exception thread-safety and is provided in #"@Tools/libgcc2.c.diff"#. Once you get the right compiler, this implementation is remarkably compact and portable. A variety of processors are supported, including mips, intel, sparc, hppa, and alpha. [-DTHREADMODEL=JRITHREADS] Java implementation hooks. Multi-threading within a Netscape plugin can be tricky. A simple idea however consists of implementing the threading primitives in Java and to access them using JRI. The classes just contain a JRIGlobalRef. This is not a real implementation since everything (Java code, native functions, stubs, exception thread safety) must be addressed by the plugin source code. Performance may be a serious issue. {description} { Portability}: The simultaneous use of threads and exceptions caused a lot of portability headaches under Unix. We eventually decided to implement the COTHREADS cooperative threads (because preemptive threads have more problems) and to patch EGCS in order to make exception handling COTHREAD-safe. Portable threads From: Leon Bottou, 1/31/2002 Almost unchanged by Lizardtech. GSafeFlags should go because it not as safe as it claims.
| |
#define | COTHREADS 1 |
#define | JRITHREADS 2 |
#define | MACTHREADS 12 |
#define | NOTHREADS 0 |
#define | POSIXTHREADS 10 |
#define | THREADMODEL NOTHREADS |
#define | WINTHREADS 11 |
Define Documentation
#define COTHREADS 1 |
Definition at line 138 of file GThreads.h.
#define JRITHREADS 2 |
Definition at line 139 of file GThreads.h.
#define MACTHREADS 12 |
Definition at line 142 of file GThreads.h.
#define NOTHREADS 0 |
Definition at line 137 of file GThreads.h.
#define POSIXTHREADS 10 |
Definition at line 140 of file GThreads.h.
#define THREADMODEL NOTHREADS |
Definition at line 157 of file GThreads.h.
#define WINTHREADS 11 |
Definition at line 141 of file GThreads.h.