libdap  Updated for version 3.20.6
libdap4 is an implementation of OPeNDAP's DAP protocol.
libdap::Locker Class Reference

#include <MarshallerThread.h>

Public Member Functions

 Locker (pthread_mutex_t &lock, pthread_cond_t &cond, int &count)
 
virtual ~Locker ()
 

Detailed Description

RAII for the MarshallerThread mutex and condition variable. Used by the Main thread. The constructor locks the mutex and then, if the count of child threads is not zero, blocks on the associated condition variable. When signaled by the child thread using the condition variable (the child thread count should then be zero), the mutex is (re)locked and the ctor returns. The destructor unlocks the mutex.

Definition at line 52 of file MarshallerThread.h.

Constructor & Destructor Documentation

◆ Locker()

Locker::Locker ( pthread_mutex_t &  lock,
pthread_cond_t &  cond,
int &  count 
)

Lock the mutex then wait for the child thread to signal using the condition variable 'cond'. Once the signal is received, re-test count to make sure it's zero (there are no child threads).

This is used to lock the main thread and ensure that a second child (writer) thread is not started until any current child thread completes, which keeps the write operations in the correct order.

Definition at line 88 of file MarshallerThread.cc.

◆ ~Locker()

Locker::~Locker ( )
virtual

Unlock the mutex

Definition at line 108 of file MarshallerThread.cc.


The documentation for this class was generated from the following files: