TurboJPEG: Thread-safe error message retrieval

Introduce a new C API function (tjGetErrorStr2()) that can be used to
retrieve compression/decompression/transform error messages in a
thread-safe (i.e. instance-specific) manner.  Retrieving error messages
from global functions is still thread-unsafe.

Addresses a concern expressed in #151.
This commit is contained in:
DRC
2017-05-11 21:02:29 -05:00
parent 2ac4e9d914
commit b9ab64d8db
21 changed files with 152 additions and 91 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2011-2016 D. R. Commander. All Rights Reserved.
* Copyright (C)2011-2017 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -46,7 +46,7 @@
goto bailout; \
}
#define _throwtj() _throw(tjGetErrorStr(), "org/libjpegturbo/turbojpeg/TJException")
#define _throwtj() _throw(tjGetErrorStr2(handle), "org/libjpegturbo/turbojpeg/TJException")
#define _throwarg(msg) _throw(msg, "java/lang/IllegalArgumentException")