You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment there are several thread-safety issues in c_interface.
Shared global variable std::string message (shared across GetRequestLength, CopyRequestResult, DisposeRequest, RequetThetaMatrix, RequestTopicModel, RequestScore).
Current behavior of this functions is undefined if the user issues several request from concurrent threads. I suggest the following fix:
keep "std::string message" in boost::thread_local_storage. This allows user to use several concurrent threads to issue requests in parallel.
Remove functions GetRequestLengt and DisposeRequest, because they can be avoided. To achieve this, change RequestXXX functions to return the length of the request instead of the "request id". If request failed, return the error code, which is a negative value - and therefore it can be distinguished from successful request (non-negative return value). Document, that each use thread must use the following sequence to retrieve request:
RequestXXX -> allocate buffer -> CopyRequestResult.
Interleaving requests are not valid, e.g. RequestXXX -> RequestYYY -> CopyRequestResult(XXX) -> CopyRequestResult(YYY) is not supported. Indeed, there is no reason for user to do this!
ArtmGetLastErrorMessage
Again, use boost::thread_local_storage to keep the last error message.
The text was updated successfully, but these errors were encountered:
At the moment there are several thread-safety issues in c_interface.
Current behavior of this functions is undefined if the user issues several request from concurrent threads. I suggest the following fix:
RequestXXX -> allocate buffer -> CopyRequestResult.
Interleaving requests are not valid, e.g. RequestXXX -> RequestYYY -> CopyRequestResult(XXX) -> CopyRequestResult(YYY) is not supported. Indeed, there is no reason for user to do this!
Again, use boost::thread_local_storage to keep the last error message.
The text was updated successfully, but these errors were encountered: