Opened 6 years ago
Closed 6 years ago
#12486 closed Bugs (invalid)
system_error_code for thread safe
Reported by: | Owned by: | Ion Gaztañaga | |
---|---|---|---|
Milestone: | To Be Determined | Component: | interprocess |
Version: | Boost 1.61.0 | Severity: | Problem |
Keywords: | Cc: |
Description
if(!create_directory(root_shared_dir.c_str())){
error_info info(system_error_code()); if(info.get_error_code() != already_exists_error){
throw interprocess_exception(info);
}
}
If the directory exists, get last error is already_exists_error, but in the multi thread environment, last_error will be rewritten by another thread.
Whether this can be improved by compiler options?
test environment: MAC OS
Change History (3)
comment:1 by , 6 years ago
comment:2 by , 6 years ago
Component: | None → interprocess |
---|---|
Owner: | set to |
comment:3 by , 6 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
get_last_error is a wrapper for errno in Unix systems. POSIX requires that errno be threadsafe so there is an errno value for each thread using thread specific data, no other thread can overwrite the last error for this thread.
Please specify which boost library you are using, and assign this ticket to the appropriate component - otherwise nothing will happen here!