Multi-Threaded Programming in C++ by Mark Walmsley PhD, BSc (auth.)

By Mark Walmsley PhD, BSc (auth.)

Show description

Read or Download Multi-Threaded Programming in C++ PDF

Similar programming: programming languages books

Objektorientierte Programmiersprache C++: Vollständige Einführung anhand von Beispielen (VDI-Buch) (German Edition)

In diesem Werk werden alle Aspekte der Sprache C++ behandelt, deshalb ist das Buch ebenso für Einsteiger, mit oder ohne Vorkenntnisse über eine andere Programmiersprache, als auch für Umsteiger von anderen Programmiersprachen bzw. C-Programmierer geeignet. Die Darstellung der Sachverhalte erfolgt knapp und systematisch, die Beispiele sind kurz, prägnant und compiler- unabhängig und auf allen Rechnern mit C++ 2.

Additional info for Multi-Threaded Programming in C++

Example text

El to tell the other thread when a signal IS required. Sometimes it is useful to pulse an event - the event moves to tlle signalled state for tlle duration of the pulse and then returns to the non-signalled state. If there are 110 threads waiting for the event tben the pulse has no effect but if there are waiters then one or more threads should be released - Windows provides a PulseEvent () function which releases one thread for an automatic event and all threads for a manual eyenL A simple generic implementation of event pulsing using a manual eYen!

The ATOMIC class Execute () function calls the Execute () function of each of the ATOMIC_ACTION objects from the list these objects actually belong to various classes derived from the ATOMI C_ ACTION class: class ATOMIC_ACTION ( public: virtual void Execute (void*) }; 0; Mutexes 35 The ATOMI C_ACTION class specifies a single virtual function giving the types of its parameter and return value - the parameter is a void* pointer and the return type is void. The marker =0 indicates that the function is 'pure virtual', meaning that the ATOMIC_ACTION class provides no definition of the implementation of the function.

The thread context contains enough information to transparently continue tlle thread's processing from the point where it was last interrupted. The thread context includes the tllread's stack and the processor registers along with any user-defined 24 Multi-Threaded Programming in C++ keys - in particular, the stack holds function parameters and local variables. In addition to the thread-specific data in the thread context, each thread also shares the resources of the process to which it belongs - the process provides shared program code, shared static storage and dynamic storage.

Download PDF sample

Rated 4.43 of 5 – based on 14 votes