diff options
author | Caroline Tice <ctice@apple.com> | 2010-09-29 18:35:42 +0000 |
---|---|---|
committer | Caroline Tice <ctice@apple.com> | 2010-09-29 18:35:42 +0000 |
commit | bd13b8d5ced97ab806f87e68945b76ed9f8c7323 (patch) | |
tree | d9a1247fe2e1a76e7900024a21cc828c88f43d07 /lldb/tools/driver/IOChannel.h | |
parent | 7d489d7a73fee8cba6ccf6327b9f634ab50f6178 (diff) | |
download | bcm5719-llvm-bd13b8d5ced97ab806f87e68945b76ed9f8c7323.tar.gz bcm5719-llvm-bd13b8d5ced97ab806f87e68945b76ed9f8c7323.zip |
Fix various timing/threading problems in IOChannel & Driver that
were causing the prompt to be stomped on, mangled or omitted occasionally.
llvm-svn: 115059
Diffstat (limited to 'lldb/tools/driver/IOChannel.h')
-rw-r--r-- | lldb/tools/driver/IOChannel.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lldb/tools/driver/IOChannel.h b/lldb/tools/driver/IOChannel.h index 90e76fbbc65..188e2a20975 100644 --- a/lldb/tools/driver/IOChannel.h +++ b/lldb/tools/driver/IOChannel.h @@ -15,6 +15,8 @@ #include <editline/readline.h> #include <histedit.h> +#include <pthread.h> +#include <sys/time.h> #include "Driver.h" @@ -89,11 +91,25 @@ public: static unsigned char ElCompletionFn (EditLine *e, int ch); +protected: + bool IsGettingCommand () const; + void + SetGettingCommand (bool new_value); + + uint64_t + Nanoseconds (const struct timeval &time_val) const; + + uint64_t + ElapsedNanoSecondsSinceEnteringElGets (); + private: + pthread_mutex_t m_output_mutex; + struct timeval m_enter_elgets_time; + Driver *m_driver; lldb::thread_t m_read_thread; bool m_read_thread_should_exit; @@ -114,4 +130,22 @@ private: HandleCompletion (EditLine *e, int ch); }; +class IOLocker +{ +public: + + IOLocker (pthread_mutex_t &mutex); + + ~IOLocker (); + +protected: + + pthread_mutex_t *m_mutex_ptr; + +private: + + IOLocker (const IOLocker&); + const IOLocker& operator= (const IOLocker&); +}; + #endif // lldb_IOChannel_h_ |