Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes | Private Member Functions
nsShortReader Class Reference
Inheritance diagram for nsShortReader:
Inheritance graph
[legend]
Collaboration diagram for nsShortReader:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS NS_IMETHOD Run ()
 Defines an entry point for a newly created thread.
 nsShortReader (nsIInputStream *in)
void Received (PRUint32 count)
PRUint32 WaitForReceipt ()
void run ()

Protected Attributes

nsIInputStreammIn
PRUint32 mReceived

Private Member Functions

 ~nsShortReader ()

Detailed Description

Definition at line 177 of file TestPipes.cpp.


Constructor & Destructor Documentation

Definition at line 207 of file TestPipes.cpp.

                                      : mIn(in), mReceived(0) {
        NS_ADDREF(in);
    }

Here is the call graph for this function:

nsShortReader::~nsShortReader ( ) [inline, private]

Definition at line 230 of file TestPipes.cpp.

                     {
        NS_RELEASE(mIn);
    }

Member Function Documentation

void nsShortReader::Received ( PRUint32  count) [inline]

Definition at line 211 of file TestPipes.cpp.

                                  {
        nsAutoCMonitor mon(this);
        mReceived += count;
        mon.Notify();
    }

Here is the caller graph for this function:

void nsIRunnable::run ( ) [inherited]

Defines an entry point for a newly created thread.

Implements nsIRunnable.

Definition at line 181 of file TestPipes.cpp.

                     {
        nsresult rv;
        char buf[101];
        PRUint32 count;
        PRUint32 total = 0;
        while (PR_TRUE) {
            //if (gTrace)
            //    printf("calling Read\n");
            rv = mIn->Read(buf, 100, &count);
            if (NS_FAILED(rv)) {
                printf("read failed\n");
                break;
            }
            if (count == 0) {
                break;
            }
            buf[count] = '\0';
            if (gTrace)
                printf("read %d bytes: %s\n", count, buf);
            Received(count);
            total += count;
        }
        printf("read  %d bytes\n", total);
        return rv;
    }

Here is the call graph for this function:

Definition at line 217 of file TestPipes.cpp.

                              {
        nsAutoCMonitor mon(this);
        PRUint32 result = mReceived;
        while (result == 0) {
            mon.Wait();
            NS_ASSERTION(mReceived >= 0, "failed to receive");
            result = mReceived;
        }
        mReceived = 0;
        return result;
    }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 235 of file TestPipes.cpp.

Definition at line 236 of file TestPipes.cpp.


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