[DEV] remove etk::mutex and etk::semaphore for stl inmplementation
This commit is contained in:
parent
b5b460440b
commit
7645341f35
2
build
2
build
@ -1 +1 @@
|
||||
Subproject commit d0fb9045c48f30eb095e9502ebd8e6e360f1d8bf
|
||||
Subproject commit 0f4349e65a10949139b15a57d2fa114e42ed6f4b
|
2
external/ege
vendored
2
external/ege
vendored
@ -1 +1 @@
|
||||
Subproject commit fd136fb6563f31fec0de8a36116c2a8562de8a9f
|
||||
Subproject commit 9930ce56c42052db422eef3de0d5494d3ccd3f10
|
2
external/etk
vendored
2
external/etk
vendored
@ -1 +1 @@
|
||||
Subproject commit 455ffb47e64fcebb8b0e6e2b21399a304b0aab55
|
||||
Subproject commit 327fdbf1a29f838df8b39ece95e21d08f5cc8410
|
@ -11,7 +11,7 @@
|
||||
#include <time.h>
|
||||
#include <stdint.h>
|
||||
#include <pthread.h>
|
||||
#include <etk/os/Mutex.h>
|
||||
#include <mutex>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/context/Context.h>
|
||||
//#include <ewol/renderer/audio/audio.h>
|
||||
@ -32,8 +32,8 @@ int64_t ewol::getTime() {
|
||||
// jni doc : /usr/lib/jvm/java-1.6.0-openjdk/include
|
||||
|
||||
static JavaVM* g_JavaVM=nullptr; // global acces on the unique JVM !!!
|
||||
etk::Mutex g_interfaceMutex;
|
||||
etk::Mutex g_interfaceAudioMutex;
|
||||
std::mutex g_interfaceMutex;
|
||||
std::mutex g_interfaceAudioMutex;
|
||||
|
||||
|
||||
void java_check_exception(JNIEnv* _env) {
|
||||
@ -646,16 +646,16 @@ extern "C" {
|
||||
// JNI onLoad
|
||||
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* _jvm, void* _reserved) {
|
||||
// get the java virtual machine handle ...
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
etk::AutoLockMutex myLock2(g_interfaceAudioMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceAudioMutex);
|
||||
g_JavaVM = _jvm;
|
||||
EWOL_DEBUG("JNI-> load the jvm ..." );
|
||||
return JNI_VERSION_1_6;
|
||||
}
|
||||
// JNI onUnLoad
|
||||
JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* _vm, void *_reserved) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
etk::AutoLockMutex myLock2(g_interfaceAudioMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceAudioMutex);
|
||||
g_JavaVM = nullptr;
|
||||
EWOL_DEBUG("JNI-> Un-load the jvm ..." );
|
||||
}
|
||||
@ -666,7 +666,7 @@ extern "C" {
|
||||
jint _id,
|
||||
jint _mode,
|
||||
jstring _myString) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
if( _id >= (int32_t)s_listInstance.size()
|
||||
|| _id<0
|
||||
|| nullptr == s_listInstance[_id] ) {
|
||||
@ -692,7 +692,7 @@ extern "C" {
|
||||
jclass _classBase,
|
||||
jobject _objCallback,
|
||||
int _typeApplication) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
EWOL_DEBUG("*******************************************");
|
||||
EWOL_DEBUG("** Creating EWOL context **");
|
||||
EWOL_DEBUG("*******************************************");
|
||||
@ -722,7 +722,7 @@ extern "C" {
|
||||
}
|
||||
|
||||
void Java_org_ewol_Ewol_EWsetJavaVirtualMachineStop(JNIEnv* _env, jclass _cls, jint _id) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
EWOL_DEBUG("*******************************************");
|
||||
EWOL_DEBUG("** remove JVM Pointer **");
|
||||
EWOL_DEBUG("*******************************************");
|
||||
@ -740,7 +740,7 @@ extern "C" {
|
||||
s_listInstance[_id]=nullptr;
|
||||
}
|
||||
void Java_org_ewol_Ewol_EWtouchEvent(JNIEnv* _env, jobject _thiz, jint _id) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
EWOL_DEBUG(" == > Touch Event");
|
||||
if( _id >= (int32_t)s_listInstance.size()
|
||||
|| _id<0
|
||||
@ -753,7 +753,7 @@ extern "C" {
|
||||
}
|
||||
|
||||
void Java_org_ewol_Ewol_EWonCreate(JNIEnv* _env, jobject _thiz, jint _id) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
EWOL_DEBUG("*******************************************");
|
||||
EWOL_DEBUG("** Activity on Create **");
|
||||
EWOL_DEBUG("*******************************************");
|
||||
@ -768,7 +768,7 @@ extern "C" {
|
||||
}
|
||||
|
||||
void Java_org_ewol_Ewol_EWonStart(JNIEnv* _env, jobject _thiz, jint _id) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
EWOL_DEBUG("*******************************************");
|
||||
EWOL_DEBUG("** Activity on Start **");
|
||||
EWOL_DEBUG("*******************************************");
|
||||
@ -782,7 +782,7 @@ extern "C" {
|
||||
//SendSystemMessage(" testmessages ... ");
|
||||
}
|
||||
void Java_org_ewol_Ewol_EWonReStart(JNIEnv* _env, jobject _thiz, jint _id) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
EWOL_DEBUG("*******************************************");
|
||||
EWOL_DEBUG("** Activity on Re-Start **");
|
||||
EWOL_DEBUG("*******************************************");
|
||||
@ -795,7 +795,7 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
void Java_org_ewol_Ewol_EWonResume(JNIEnv* _env, jobject _thiz, jint _id) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
EWOL_DEBUG("*******************************************");
|
||||
EWOL_DEBUG("** Activity on resume **");
|
||||
EWOL_DEBUG("*******************************************");
|
||||
@ -809,7 +809,7 @@ extern "C" {
|
||||
s_listInstance[_id]->OS_Resume();
|
||||
}
|
||||
void Java_org_ewol_Ewol_EWonPause(JNIEnv* _env, jobject _thiz, jint _id) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
EWOL_DEBUG("*******************************************");
|
||||
EWOL_DEBUG("** Activity on pause **");
|
||||
EWOL_DEBUG("*******************************************");
|
||||
@ -825,7 +825,7 @@ extern "C" {
|
||||
s_listInstance[_id]->OS_Suspend();
|
||||
}
|
||||
void Java_org_ewol_Ewol_EWonStop(JNIEnv* _env, jobject _thiz, jint _id) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
EWOL_DEBUG("*******************************************");
|
||||
EWOL_DEBUG("** Activity on Stop **");
|
||||
EWOL_DEBUG("*******************************************");
|
||||
@ -839,7 +839,7 @@ extern "C" {
|
||||
s_listInstance[_id]->OS_Stop();
|
||||
}
|
||||
void Java_org_ewol_Ewol_EWonDestroy(JNIEnv* _env, jobject _thiz, jint _id) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
EWOL_DEBUG("*******************************************");
|
||||
EWOL_DEBUG("** Activity on Destroy **");
|
||||
EWOL_DEBUG("*******************************************");
|
||||
@ -864,7 +864,7 @@ extern "C" {
|
||||
jint _pointerID,
|
||||
jfloat _x,
|
||||
jfloat _y) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
if( _id >= (int32_t)s_listInstance.size()
|
||||
|| _id<0
|
||||
|| nullptr == s_listInstance[_id] ) {
|
||||
@ -882,7 +882,7 @@ extern "C" {
|
||||
jboolean _isUp,
|
||||
jfloat _x,
|
||||
jfloat _y) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
if( _id >= (int32_t)s_listInstance.size()
|
||||
|| _id<0
|
||||
|| nullptr == s_listInstance[_id] ) {
|
||||
@ -899,7 +899,7 @@ extern "C" {
|
||||
jint _pointerID,
|
||||
jfloat _x,
|
||||
jfloat _y) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
if( _id >= (int32_t)s_listInstance.size()
|
||||
|| _id<0
|
||||
|| nullptr == s_listInstance[_id] ) {
|
||||
@ -917,7 +917,7 @@ extern "C" {
|
||||
jboolean _isUp,
|
||||
jfloat _x,
|
||||
jfloat _y) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
if( _id >= (int32_t)s_listInstance.size()
|
||||
|| _id<0
|
||||
|| nullptr == s_listInstance[_id] ) {
|
||||
@ -932,7 +932,7 @@ extern "C" {
|
||||
jobject _thiz,
|
||||
jint _id,
|
||||
jint _pointerID) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
if( _id >= (int32_t)s_listInstance.size()
|
||||
|| _id<0
|
||||
|| nullptr == s_listInstance[_id] ) {
|
||||
@ -948,7 +948,7 @@ extern "C" {
|
||||
jint _id,
|
||||
jint _type,
|
||||
jboolean _isdown) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
if( _id >= (int32_t)s_listInstance.size()
|
||||
|| _id<0
|
||||
|| nullptr == s_listInstance[_id] ) {
|
||||
@ -965,7 +965,7 @@ extern "C" {
|
||||
jint _id,
|
||||
jint _uniChar,
|
||||
jboolean _isdown) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
if( _id >= (int32_t)s_listInstance.size()
|
||||
|| _id<0
|
||||
|| nullptr == s_listInstance[_id] ) {
|
||||
@ -982,7 +982,7 @@ extern "C" {
|
||||
jint _id,
|
||||
jfloat _ratioX,
|
||||
jfloat _ratioY) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
if( _id >= (int32_t)s_listInstance.size()
|
||||
|| _id<0
|
||||
|| nullptr == s_listInstance[_id] ) {
|
||||
@ -1000,7 +1000,7 @@ extern "C" {
|
||||
jint _id,
|
||||
jint _keyVal,
|
||||
jboolean _isdown) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
if( _id >= (int32_t)s_listInstance.size()
|
||||
|| _id<0
|
||||
|| nullptr == s_listInstance[_id] ) {
|
||||
@ -1044,7 +1044,7 @@ extern "C" {
|
||||
void Java_org_ewol_Ewol_EWrenderInit(JNIEnv* _env,
|
||||
jobject _thiz,
|
||||
jint _id) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
if( _id >= (int32_t)s_listInstance.size()
|
||||
|| _id<0
|
||||
|| nullptr == s_listInstance[_id] ) {
|
||||
@ -1059,7 +1059,7 @@ extern "C" {
|
||||
jint _id,
|
||||
jint _w,
|
||||
jint _h) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
if( _id >= (int32_t)s_listInstance.size()
|
||||
|| _id<0
|
||||
|| nullptr == s_listInstance[_id] ) {
|
||||
@ -1074,7 +1074,7 @@ extern "C" {
|
||||
void Java_org_ewol_Ewol_EWrenderDraw(JNIEnv* _env,
|
||||
jobject _thiz,
|
||||
jint _id) {
|
||||
etk::AutoLockMutex myLock(g_interfaceMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceMutex);
|
||||
if( _id >= (int32_t)s_listInstance.size()
|
||||
|| _id<0
|
||||
|| nullptr == s_listInstance[_id] ) {
|
||||
@ -1091,7 +1091,7 @@ extern "C" {
|
||||
jshortArray _location,
|
||||
jint _frameRate,
|
||||
jint _nbChannels) {
|
||||
etk::AutoLockMutex myLock(g_interfaceAudioMutex);
|
||||
std::unique_lock<std::mutex> lock(g_interfaceAudioMutex);
|
||||
if( _id >= (int32_t)s_listInstance.size()
|
||||
|| _id<0
|
||||
|| nullptr == s_listInstance[_id] ) {
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include <etk/tool.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
#include <etk/os/Mutex.h>
|
||||
#include <mutex>
|
||||
|
||||
#include <date/date.h>
|
||||
|
||||
@ -39,8 +39,8 @@
|
||||
* @note due ti the fact that the system can be called for multiple instance, for naw we just limit the acces to one process at a time.
|
||||
* @return the main inteface Mutex
|
||||
*/
|
||||
static etk::Mutex& mutexInterface() {
|
||||
static etk::Mutex s_interfaceMutex;
|
||||
static std::mutex& mutexInterface() {
|
||||
static std::mutex s_interfaceMutex;
|
||||
return s_interfaceMutex;
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ void ewol::Context::lockContext() {
|
||||
*/
|
||||
void ewol::Context::unLockContext() {
|
||||
l_curentInterface = nullptr;
|
||||
mutexInterface().unLock();
|
||||
mutexInterface().unlock();
|
||||
}
|
||||
|
||||
|
||||
|
@ -9,15 +9,15 @@
|
||||
#include <vector>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/openGL/openGL.h>
|
||||
#include <etk/os/Mutex.h>
|
||||
#include <mutex>
|
||||
|
||||
/**
|
||||
* @brief get the draw mutex (ewol render).
|
||||
* @note due ti the fact that the system can be called for multiple instance, for naw we just limit the acces to one process at a time.
|
||||
* @return the main inteface Mutex
|
||||
*/
|
||||
static etk::Mutex& mutexOpenGl() {
|
||||
static etk::Mutex s_drawMutex;
|
||||
static std::mutex& mutexOpenGl() {
|
||||
static std::mutex s_drawMutex;
|
||||
return s_drawMutex;
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ void ewol::openGL::lock() {
|
||||
}
|
||||
|
||||
void ewol::openGL::unLock() {
|
||||
mutexOpenGl().unLock();
|
||||
mutexOpenGl().unlock();
|
||||
}
|
||||
|
||||
void ewol::openGL::setBasicMatrix(const mat4& _newOne) {
|
||||
|
@ -28,7 +28,7 @@ ewol::widget::Entry::Entry() :
|
||||
m_shaper(*this, "shaper", "Shaper to display the background"),
|
||||
m_data(*this, "value", "", "Value display in the entry (decorated text)"),
|
||||
m_maxCharacter(*this, "max", 0x7FFFFFFF, 0, 0x7FFFFFFF, "Maximum cgar that can be set on the Entry"),
|
||||
m_regExp(*this, "regExp", "Control what it is write with a regular expression"),
|
||||
m_regexValue(*this, "regex", ".*", "Control what it is write with a regular expression"),
|
||||
m_needUpdateTextPos(true),
|
||||
m_displayStartPosition(0),
|
||||
m_displayCursor(false),
|
||||
@ -43,8 +43,12 @@ void ewol::widget::Entry::init(const std::string& _newData) {
|
||||
m_data.set(_newData);
|
||||
m_shaper.setString("THEME:GUI:Entry.json");
|
||||
setCanHaveFocus(true);
|
||||
m_regExp.setString(".*");
|
||||
m_regExp.get().setMaximize(true);
|
||||
|
||||
try {
|
||||
m_regex.assign(".*", std::regex_constants::optimize | std::regex_constants::ECMAScript);
|
||||
} catch (std::regex_error e) {
|
||||
EWOL_ERROR("can not parse regex : '" << e.what() << "' for : " << m_regexValue);
|
||||
}
|
||||
markToRedraw();
|
||||
|
||||
shortCutAdd("ctrl+w", "clean");
|
||||
@ -414,14 +418,18 @@ void ewol::widget::Entry::setInternalValue(const std::string& _newData) {
|
||||
std::string previous = m_data;
|
||||
// check the RegExp :
|
||||
if (_newData.size()>0) {
|
||||
if (false == m_regExp->parse(_newData,0,_newData.size()) ) {
|
||||
EWOL_INFO("the input data does not match with the regExp \"" << _newData << "\" RegExp=\"" << m_regExp->getRegExp() << "\" start=" << m_regExp->start() << " stop=" << m_regExp->stop() );
|
||||
std::smatch resultMatch;
|
||||
std::regex_search(_newData.begin(), _newData.end(), resultMatch, m_regex, std::regex_constants::match_continuous);
|
||||
if (resultMatch.size() <= 0) {
|
||||
EWOL_INFO("The input data does not match with the regExp '" << _newData << "' Regex='" << m_regexValue << "'" );
|
||||
return;
|
||||
}
|
||||
//EWOL_INFO("find regExp : \"" << m_data << "\" start=" << m_regExp.Start() << " stop=" << m_regExp.Stop() );
|
||||
if( 0 != m_regExp->start()
|
||||
|| _newData.size() != (size_t)m_regExp->stop() ) {
|
||||
EWOL_INFO("The input data match not entirely with the regExp \"" << _newData << "\" RegExp=\"" << m_regExp->getRegExp() << "\" start=" << m_regExp->start() << " stop=" << m_regExp->stop() );
|
||||
if (_newData.begin() != resultMatch[0].first) {
|
||||
EWOL_INFO("The input data does not match with the regExp '" << _newData << "' Regex='" << m_regexValue << "' (start position error)" );
|
||||
return;
|
||||
}
|
||||
if (_newData.end() != resultMatch[0].second) {
|
||||
EWOL_INFO("The input data does not match with the regExp '" << _newData << "' Regex='" << m_regexValue << "' (stop position error)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -563,10 +571,11 @@ void ewol::widget::Entry::onParameterChangeValue(const ewol::object::ParameterRe
|
||||
markToRedraw();
|
||||
} else if (_paramPointer == m_maxCharacter) {
|
||||
// nothing to do ...
|
||||
} else if (_paramPointer == m_regExp) {
|
||||
if (m_regExp->getStatus() == false) {
|
||||
EWOL_ERROR("error when adding regExp ... == > set the '\".*\"' ...");
|
||||
m_regExp->compile(".*");
|
||||
} else if (_paramPointer == m_regexValue) {
|
||||
try {
|
||||
m_regex.assign(m_regexValue.get(), std::regex_constants::optimize | std::regex_constants::ECMAScript);
|
||||
} catch (std::regex_error e) {
|
||||
EWOL_ERROR("can not parse regex : '" << e.what() << "' for : " << m_regexValue);
|
||||
}
|
||||
markToRedraw();
|
||||
} else if (_paramPointer == m_textWhenNothing) {
|
||||
|
@ -10,7 +10,7 @@
|
||||
#define __EWOL_ENTRY_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/RegExp.h>
|
||||
#include <regex>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/compositing/Text.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
@ -96,21 +96,22 @@ namespace ewol {
|
||||
return m_maxCharacter;
|
||||
};
|
||||
private:
|
||||
ewol::object::Param<etk::RegExp<std::string>> m_regExp; //!< regular expression to limit the input of an entry
|
||||
ewol::object::Param<std::string> m_regexValue; //!< regular expression value
|
||||
std::regex m_regex; //!< regular expression to check content
|
||||
public:
|
||||
/**
|
||||
* @brief Limit the input entry at a regular expression... (by default it is "*")
|
||||
* @param _expression New regular expression
|
||||
*/
|
||||
void setRegExp(const std::string& _expression) {
|
||||
m_regExp.setString(_expression);
|
||||
void setRegex(const std::string& _expression) {
|
||||
m_regexValue.set(_expression);
|
||||
}
|
||||
/**
|
||||
* @brief get the regualar expression limitation
|
||||
* @param The regExp string
|
||||
*/
|
||||
std::string getRegExp() const {
|
||||
return m_regExp->getRegExp();
|
||||
std::string getRegex() const {
|
||||
return m_regexValue;
|
||||
};
|
||||
private:
|
||||
bool m_needUpdateTextPos; //!< text position can have change
|
||||
|
Loading…
x
Reference in New Issue
Block a user