orc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ClydeZhao <...@git.apache.org>
Subject [GitHub] orc issue #65: ORC-110: [C++] getTimezoneByFilename is not thread safe
Date Fri, 18 Nov 2016 13:44:14 GMT
Github user ClydeZhao commented on the issue:

    https://github.com/apache/orc/pull/65
  
    Should we write our own? It is not complicated after all. I am thinking a class like this
would be good enough:
    ```c++
      /**
       * Lock guard for pthread_mutex_t object using RAII
       * The Lock is automatically release when exiting current scope.
       */
      class Lock {
        public:
          explicit Lock(pthread_mutex_t* mutex) : mutex_ptr_(mutex) {
            pthread_mutex_lock(mutex_ptr_);
          }
          ~Lock() { pthread_mutex_unlock(mutex_ptr_); }
        private:
           // no default constructor
           Lock();
           // prohibit copying
           Lock(const Lock&);
           Lock& operator=(const Lock&);
    
           pthread_mutex_t* mutex_ptr_;
      };
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message