Home | History | Annotate | Download | only in jni
      1 /*
      2  * Copyright (C) 2011 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef FRAMEWORKS_EX_VARIABLESPEED_JNI_NO_SYNCHRONIZATION_H_
     18 #define FRAMEWORKS_EX_VARIABLESPEED_JNI_NO_SYNCHRONIZATION_H_
     19 
     20 #include <macros.h>
     21 
     22 // We don't need any synchronization at the moment.
     23 // The sola_time_scaler (which is the code that uses this mutex class) is
     24 // currently being used in a single-threaded manner, driven from the main
     25 // PlayFromThisSource method in variablespeed.
     26 // As such no locking is actually required, and so this class contains a
     27 // fake mutex that does nothing.
     28 
     29 class Mutex {
     30  public:
     31   Mutex() {}
     32   virtual ~Mutex() {}
     33   void Lock() {}
     34   void Unlock() {}
     35 
     36  private:
     37   DISALLOW_COPY_AND_ASSIGN(Mutex);
     38 };
     39 
     40 class MutexLock {
     41  public:
     42   explicit MutexLock(Mutex* mu) : mu_(mu) {}
     43   virtual ~MutexLock() {}
     44 
     45  private:
     46   Mutex* const mu_;
     47   DISALLOW_COPY_AND_ASSIGN(MutexLock);
     48 };
     49 
     50 #endif  // FRAMEWORKS_EX_VARIABLESPEED_JNI_NO_SYNCHRONIZATION_H_
     51