Browse Source

Synchronized the method Engine.myself(). Seems to solve the problem.

Enhanced DSL keyword "basic" with a "sync" option.
Increased threads count in tests to 2000
JNI-88
heck 5 years ago
parent
commit
d01d04ef85
  1. 12
      src/gen_java_Engine.ysl2
  2. 32
      src/pEp.yml2
  3. 2
      test/JNI_88/JNI_88.java

12
src/gen_java_Engine.ysl2

@ -25,9 +25,19 @@ tstylesheet {
|| ||
} }
function "syncmode" {
param "sync";
choose {
when "$sync='sync'" > synchronized
otherwise value "''";
}
}
template "basic" { template "basic" {
const "itype" call "toIntermediate" with "type", "@type"; const "itype" call "toIntermediate" with "type", "@type";
const "jtype" call "toJava" with "type", "@type"; const "jtype" call "toJava" with "type", "@type";
const "sync" call "syncmode" with "sync", "@sync";
choose { choose {
when "name(parm/*[1])='bytearray'" when "name(parm/*[1])='bytearray'"
@ -39,7 +49,7 @@ tstylesheet {
|| ||
private native «$itype» «@name»(`apply "parm/*", mode=basic_iparm`); private native «$itype» «@name»(`apply "parm/*", mode=basic_iparm`);
public «$jtype» «@name»(`apply "parm/*", mode=basic_parm`) { public «$sync» «$jtype» «@name»(`apply "parm/*", mode=basic_parm`) {
|| ||
apply "parm/*", mode=basic_parm_set; apply "parm/*", mode=basic_parm_set;
choose { choose {

32
src/pEp.yml2

@ -4,7 +4,7 @@ decl interface @name;
decl exception @name; decl exception @name;
decl method @name; decl method @name;
decl struct @name; decl struct @name;
decl basic @type @name; decl basic @sync @type @name;
namespace pEp { namespace pEp {
exception Status { exception Status {
@ -249,21 +249,21 @@ namespace pEp {
in CipherSuite suite in CipherSuite suite
); );
basic string trustwords(identity ident); basic none string trustwords(identity ident);
basic identity myself(identity ident); basic sync identity myself(identity ident);
basic identity updateIdentity(identity ident); basic none identity updateIdentity(identity ident);
basic identity setOwnKey(identity ident, string fpr); basic none identity setOwnKey(identity ident, string fpr);
basic void keyMistrusted(identity ident); basic none void keyMistrusted(identity ident);
basic void keyResetTrust(identity ident); basic none void keyResetTrust(identity ident);
basic void trustPersonalKey(identity ident); basic none void trustPersonalKey(identity ident);
basic void trustOwnKey(identity ident); basic none void trustOwnKey(identity ident);
basic void importKey(bytearray key); basic none void importKey(bytearray key);
basic void blacklist_add(string fpr); basic none void blacklist_add(string fpr);
basic void blacklist_delete(string fpr); basic none void blacklist_delete(string fpr);
basic bool blacklist_is_listed(string fpr); basic none bool blacklist_is_listed(string fpr);
basic void config_passive_mode(bool enable); basic none void config_passive_mode(bool enable);
basic void config_unencrypted_subject(bool enable); basic none void config_unencrypted_subject(bool enable);
basic string getCrashdumpLog(int maxlines); basic none string getCrashdumpLog(int maxlines);
}; };
struct message { struct message {

2
test/JNI_88/JNI_88.java

@ -97,7 +97,7 @@ class JNI_88 {
public static void main(String[] args) { public static void main(String[] args) {
// Test parameters // Test parameters
boolean useSharedEngine = true; boolean useSharedEngine = true;
int numThreads = 2; int numThreads = 2000;
int numIters = 1000000000; int numIters = 1000000000;
Engine sharedEngine = null; Engine sharedEngine = null;

Loading…
Cancel
Save