AVPKit
Mutex.h
1 /*******************************************************************************
2  * Copyright (c) 2024, 2026, Olivier Ayache. All rights reserved.
3  *
4  * This file is part of AVPKit.
5  *
6  * AVPKit is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * AVPKit is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with AVPKit. If not, see <http://www.gnu.org/licenses/>.
18  *******************************************************************************/
19 
20 #ifndef MUTEX_H_
21 #define MUTEX_H_
22 
23 #include <com/avpkit/ferry/RefCounted.h>
24 
25 namespace com { namespace avpkit { namespace ferry {
26 
40  class VS_API_FERRY Mutex : public RefCounted
41  {
42  public:
43  static Mutex * make();
44 
45  void lock();
46  void unlock();
47  protected:
48  Mutex();
49  virtual ~Mutex();
50  private:
51  jobject mLock;
52  volatile int64_t mSpinCount;
53 
54  static bool init();
55  static void initJavaBindings(JavaVM* vm, void* closure);
56  static bool mInitialized;
57  static jclass mClass;
58  static jmethodID mConstructorMethod;
59 
60 
61  };
62 
63 }}}
64 
65 #endif /*MUTEX_H_*/
Internal Only.
Definition: Mutex.h:41
Parent of all Ferry objects – it mains reference counts in native code.
Definition: RefCounted.h:85
WARNING: Do not use logging in this class, and do not set any static file variables to values other t...