mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Fix thread-safe issues with Hash_of_ints
This commit is contained in:
parent
8fc07752e9
commit
06c877f36c
@ -22,8 +22,8 @@ public class Hash_adp__int {
|
||||
private final Int_obj_ref tmp_key = Int_obj_ref.New_neg1();
|
||||
public void Clear() {hash.Clear();}
|
||||
public int Len() {return hash.Count();}
|
||||
public Object Get_by_or_fail(int key) {return hash.Get_by_or_fail(tmp_key.Val_(key));}
|
||||
public Object Get_by_or_null(int key) {return hash.Get_by(tmp_key.Val_(key));}
|
||||
public Object Get_by_or_fail(int key) {synchronized (tmp_key) {return hash.Get_by_or_fail(tmp_key.Val_(key));}} // LOCK:used by Xomp_ns_ord_mgr in xomp; DATE:2016-10-18
|
||||
public Object Get_by_or_null(int key) {synchronized (tmp_key) {return hash.Get_by(tmp_key.Val_(key));}} // LOCK:used by Xomp_ns_ord_mgr in xomp; DATE:2016-10-18
|
||||
public void Add(int key, Object obj) {hash.Add(Int_obj_ref.New(key), obj);}
|
||||
public void Add(Int_obj_ref key, Object obj) {hash.Add(key, obj);}
|
||||
public void Add_if_dupe_use_1st(int key, Object obj) {hash.Add_if_dupe_use_1st(Int_obj_ref.New(key), obj);}
|
||||
|
@ -18,12 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.langs.gfs; import gplx.*; import gplx.langs.*;
|
||||
import gplx.core.gfo_regys.*;
|
||||
public class Gfs_msg_bldr implements GfoMsgParser {
|
||||
private final Object thread_lock = new Object();
|
||||
private final Gfs_parser parser = new Gfs_parser();
|
||||
public GfoMsg ParseToMsg(String s) {return Bld(s);}
|
||||
public GfoMsg Bld(String src) {return Bld(Bry_.new_u8(src));}
|
||||
public GfoMsg Bld(byte[] src) {
|
||||
Gfs_nde nde = parser.Parse(src);
|
||||
return Bld_msg(src, nde);
|
||||
synchronized (thread_lock) { // LOCK:Gfs_parser called when converting messages in Xow_msg_mgr; DATE:2016-10-18
|
||||
Gfs_nde nde = parser.Parse(src);
|
||||
return Bld_msg(src, nde);
|
||||
}
|
||||
}
|
||||
private GfoMsg Bld_msg(byte[] src, Gfs_nde nde) {
|
||||
boolean op_is_assign = (nde.Op_tid() == Gfs_nde.Op_tid_assign);
|
||||
|
Loading…
Reference in New Issue
Block a user