folly::AsyncPipeReader

Read from a pipe in an async manner.

Synopsis

Declared in <folly/io/async/AsyncPipe.h>

class AsyncPipeReader
    : public EventHandler
    , public AsyncReader
    , public DelayedDestruction

Base Classes

NameDescription
EventHandlerThe EventHandler class is used to asynchronously wait for events on a file descriptor.
AsyncReaderInterface for the read side of an asynchronous transport.
DelayedDestructionDelayedDestruction is a helper class to ensure objects are not deleted while they still have functions executing in a higher stack frame.

Types

NameDescription
Destructor Helper class to allow DelayedDestruction classes to be used with std::shared_ptr.
DestructorGuard Classes should create a DestructorGuard object on the stack in any function that may invoke callback functions.
IntrusivePtr This smart pointer is a convenient way to manage a concrete DelayedDestructorBase child. It can replace the equivalent raw pointer and provide automatic memory management.
ReadCallback Callback interface used to receive data read from the transport.

Type Aliases

NameDescription
UniquePtr Smart pointer type that destroys the reader through DelayedDestruction.

Enums

NameDescription
EventFlags Bitset flags describing the I/O events a handler can wait for.

Member Functions

NameDescription
AsyncPipeReader [constructor]Construct an AsyncPipeReader for the given pipe file descriptor.
operator= Assignment operators
activateEvent Make an event active.
attachEventBase Attach the handler to a EventBase.
changeHandlerFD Change the file descriptor that this handler is associated with.
destroy [virtual]destroy() requests destruction of the object.
detachEventBase Detach the handler from its EventBase.
getDestroyPending Returns whether destruction has been requested but deferred.
getReadCallback [virtual]Get the read callback
getRegisteredEvents Return the set of events that we're currently registered for.
handlerReady [virtual]handlerReady() is invoked when the handler is ready.
initHandler Attach the handler to a EventBase, and change the file descriptor.
isHandlerRegistered Returns true if the handler is currently registered.
isPending Returns true if the handler is registered but has not yet fired.
registerHandler Register the handler.
registerInternalHandler Register the handler as an internal event.
setCloseCallback Set a special hook to close the socket (otherwise, will call close())
setEdgeTriggered If supported by the backend updates the event to be edge-triggered. Returns true iff the update was successful.
setReadCB setReadCB overloads
takePreReceivedData [virtual]Take any data received before a read callback was installed.
unregisterHandler Unregister the handler, if it is registered.

Static Member Functions

NameDescription
newReader Create a new AsyncPipeReader managed by a UniquePtr.

Protected Member Functions

NameDescription
getDestructorGuardCount Get the number of DestructorGuards currently protecting this object.
onDelayedDestroy [virtual]Implement onDelayedDestroy in subclasses. onDelayedDestroy() is invoked when the object is potentially being destroyed.