OLD | NEW |
1 //===-- SRPCStreamer.h - Stream bitcode over SRPC ------------------------===// | 1 //===-- SRPCStreamer.h - Stream bitcode over SRPC ------------------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 #ifndef SRPCSTREAMER_H | 9 #ifndef SRPCSTREAMER_H |
10 #define SRPCSTREAMER_H | 10 #define SRPCSTREAMER_H |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 SRPCStreamer() : Error(false) {} | 91 SRPCStreamer() : Error(false) {} |
92 // Initialize streamer, create a new thread running Callback, and | 92 // Initialize streamer, create a new thread running Callback, and |
93 // return a pointer to the DataStreamer the threads will use to | 93 // return a pointer to the DataStreamer the threads will use to |
94 // synchronize. On error, return NULL and fill in the ErrorMsg string | 94 // synchronize. On error, return NULL and fill in the ErrorMsg string |
95 llvm::DataStreamer *init(void *(*Callback)(void *), | 95 llvm::DataStreamer *init(void *(*Callback)(void *), |
96 void *arg, std::string *ErrMsg); | 96 void *arg, std::string *ErrMsg); |
97 // Called by the RPC thread. Copy len bytes from buf. Return bytes copied. | 97 // Called by the RPC thread. Copy len bytes from buf. Return bytes copied. |
98 size_t gotChunk(unsigned char *bytes, size_t len); | 98 size_t gotChunk(unsigned char *bytes, size_t len); |
99 // Called by the RPC thread. Wait for the compilation thread to finish. | 99 // Called by the RPC thread. Wait for the compilation thread to finish. |
100 int streamEnd(std::string *ErrMsg); | 100 int streamEnd(std::string *ErrMsg); |
101 // Called by the compilation thread. Signal that there was a compilation | 101 // Called by the compilation thread. Set the error condition and also |
102 // error so the RPC thread can abort the stream. | 102 // terminate the thread. |
103 void setError() { Error = true; } | 103 void setFatalError(const std::string& message); |
104 private: | 104 private: |
105 bool Error; | 105 int Error; |
| 106 std::string ErrorMessage; |
106 QueueStreamer Q; | 107 QueueStreamer Q; |
107 pthread_t CompileThread; | 108 pthread_t CompileThread; |
108 }; | 109 }; |
109 | 110 |
110 | 111 |
111 | 112 |
112 #endif // SRPCSTREAMER_H | 113 #endif // SRPCSTREAMER_H |
OLD | NEW |