GCGlib  0.04.228
GCG Graphics Engine
Processes, threads and synchronization

Classes

class  gcgTHREAD
 Generic abstract class for defining a thread. More...
 
class  gcgLOCK
 Defines a lock for easy critical section control. Provides timed lock, which tries to lock an internal mutex before a given timeout has elapsed. More...
 
class  gcgQUEUE
 Defines a queue with synchronized access. This is a standard data structure that may be used with First-In-First-Out or Last-In-First-Out policies. This is intended for multi-task applications. Use gcgLINKEDLIST if you do not need exclusive accesses in enqueue and dequeue operations. More...
 
class  gcgCACHE
 Defines a synchronized and thread safe memory cache. This is an abstract data structure that may be used to restrict the existence of multiple objects at a time in memory. This class manages key/value pairs using a TRIE tree and a double linked list. The key is generally, a short and unique identity for the data which, in turn, can be of any size. In fact, gcgCACHE stores only the pointer to the data regardless the memory chunk it spans. A key in gcgCACHE can have up to 255 bytes, or be a null terminated string, and all methods access it by a pointer. If the key has at most sizeof(long), the underlying data structure will work more efficiently due to specific optimizations. The size in bytes of the key is configured with setKeySize() method. If zero is given, the keys are treated as null terminated strings with a maximum length of 254. Note that the keys are stored internally for each key/value pair. There are two main interfaces: one for the application requests (non-virtual and data independent methods) and one for the data creation, removal and persistence (abstract, virtual and data dependent methods that must be implemented). The main application interface consists of the get() method for which the application presents the desired key and, if the corresponding data is cached (cache hit), it returns its pointer immediately (its entry is marked as the most recently used). If the data is not present (cache miss), the data interface is called for its retrieval before get() returns. In this case, the gcgCLASS calls the retrieveData() method to get the missing data for the requested key. If the missing data is retrieved but the cache is full (the cache cost capacity exceeds with the new key/value cost), the gcgCACHE calls the discardData() to delete or persist the least recently used key/value pairs until the cost of the new key/value fits in the cache limit. At any time, the application can discard one or all entries by calling flush() method. More...
 
class  gcgJOB
 Generic abstract class for defining a job/task for using with GCGlib. It inherits gcgORDEREDNODE in order to be used in one linked list. More...
 
class  gcgTHREADPOOL
 Controls a pool of threads for executing multiple jobs concurrently. More...
 
class  gcgPRODUCERCONSUMER
 Controls and synchronizes multiple producers and consumers accessing a shared and limited buffer. Supports blocking and non-blocking calls to put() and get(). More...
 

Functions

unsigned int gcgGetNumberOfProcessors ()
 Gets the number of processors installed in the system. More...
 

Detailed Description

GCGlib has classes and functions to make the control of processes, threads and their synchronization easier.

Function Documentation

◆ gcgGetNumberOfProcessors()

unsigned int gcgGetNumberOfProcessors ( )

Gets the number of processors installed in the system.

Returns
number of available processors in the system.
See also
gcgTHREAD
gcgTHREADPOOL
gcgJOB
gcgPRODUCERCONSUMER
gcgLOCK
Since
0.01.6