Comments (5)
Interesting that Android removed __sync_add_and_fetch
. Did they offer any replacement for this?
https://github.com/civetweb/civetweb/blob/master/examples/ws_server/ws_server.c#L48 is only an example code, not part of the portable web server core. This example probably only runs on Linux, also not on Windows. It could be changed to use #if defined(WIN32) ... #elif defined(OSX) ... #elif defined(LINUX) ... #elif define(ANDROID) && (NDK_Version>23) ... #elif define(ANDROID) && (NDK_Version<=23) ... #else .... #endif
and using a pthread_mutex
or CriticalSession
or any other operating system or library depending lock mechanism.
from civetweb.
from civetweb.
There I read the android development switched from GCC to CLANG.
But __sync_add_and_fetch is provided by clang, provided you use a recent version (llvm/llvm-project#62084).
Although, it could be the new version needs __atomic_add_fetch
instead of the older __sync_add_and_fetch
- unfortunately this change will break the build for older compilers.
from civetweb.
Android used to use __snyc_add_and_fetch (https://android.googlesource.com/platform/art/+/2ec6520/runtime/atomic.h)
Now it is probably int32_t android_atomic_add(int32_t value, volatile int32_t* addr);
(https://android.googlesource.com/platform/system/core/+/ac322da/include/cutils/atomic.h#41).
I cannot really find a good source on this and I did not download the new NDK yet - this may take a while to check.
from civetweb.
But I also believe that all NDK versions should work with all SDK versions, so in this sense an upgrade just for this library is not necessary. However, then it's not possible to mix it with libraries that work with NDK >= 23.
The below snippet suggests that the replacement is android_atomic_inc(&value_) + 1;
https://android.googlesource.com/platform/art/+/b122a4b%5E%21/
- int32_t operator++() {
- return android_atomic_inc(&value_) + 1;
+ int32_t operator++() { // Prefix operator.
+ return __sync_add_and_fetch(&value_, 1); // Return new value.
}
from civetweb.
Related Issues (20)
- Why are the test examples in .xhtml? HOT 1
- Are there recommended ways to get OpenSSL support for Android? HOT 4
- CodeQL not working HOT 1
- Manual did not mention preparations for OpenSSL support?
- example client showing unrecognized chars in "Content" HOT 1
- Integer overflow (leading to stack-based buffer overflow) in embedded lua_struct.c HOT 7
- Here is a negation overflow in lua HOT 5
- Can't get index.lua file working on Linux. HOT 2
- mg.redirect and mg.send_http_redirect fall in an infinite loop
- strtod() in civetweb 1.16. HOT 5
- mg_set_request_handler callback function is hit after 10-20seconds of receiving the http get request HOT 1
- Crash in function mg_handle_form_request() when receiving badly formed form data post. HOT 3
- Array overrun is possible. The '1' index is pointing beyond array bound. HOT 2
- Feature request: Allow the specification of multiple directories for fallback_document_root HOT 3
- When I refreshed the web page, a segmentation fault occurred in the program. HOT 1
- Calling the correct handler for uri HOT 1
- Missing mg_start2.md document
- socket memory buffer HOT 1
- how to remove the header and footer while using mg_read HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from civetweb.