Open source C and C++ developer focusing on small, easy to use libraries with no dependencies and simple build systems.
mackron / c89thread Goto Github PK
View Code? Open in Web Editor NEWC89 compatible threads.
C89 compatible threads.
I am unable to use the library with Clang or GCC on Linux, these are the errors:
With clang:
./c89thread.h:1411:9: error: use of undeclared identifier 'pSem'; did you mean 'sem'?
if (pSem->value < pSem->valueMax) {
^~~~
sem
./c89thread.h:1398:27: note: 'sem' declared here
int c89sem_post(c89sem_t* sem)
^
./c89thread.h:1411:23: error: use of undeclared identifier 'pSem'; did you mean 'sem'?
if (pSem->value < pSem->valueMax) {
^~~~
sem
./c89thread.h:1398:27: note: 'sem' declared here
int c89sem_post(c89sem_t* sem)
^
./c89thread.h:1412:9: error: use of undeclared identifier 'pSem'
pSem->value += 1;
^
./c89thread.h:1413:30: error: use of undeclared identifier 'pSem'; did you mean 'sem'?
pthread_cond_signal(&pSem->cond);
^~~~
sem
./c89thread.h:1398:27: note: 'sem' declared here
int c89sem_post(c89sem_t* sem)
^
./c89thread.h:1566:5: error: void function 'c89timespec_get' should not return a value [-Wreturn-type]
return timespec_get(ts, base);
^ ~~~~~~~~~~~~~~~~~~~~~~
With GCC:
c89thread.h: In function ‘c89sem_post’:
c89thread.h:1411:9: error: ‘pSem’ undeclared (first use in this function)
1411 | if (pSem->value < pSem->valueMax) {
| ^~~~
c89thread.h:1411:9: note: each undeclared identifier is reported only once for each function it appears in
c89thread.h: In function ‘c89timespec_get’:
c89thread.h:1566:12: warning: ‘return’ with a value, in function returning void [-Wreturn-type]
1566 | return timespec_get(ts, base);
| ^~~~~~~~~~~~~~~~~~~~~~
c89thread.h:1564:6: note: declared here
1564 | void c89timespec_get(struct timespec* ts, int base)
| ^~~~~~~~~~~~~~~
Also when I compile with -std=c99
or -std=c89
more error and warnings appears, so the library does not really work with C89 on Linux.
I get this compile error when using the library with Visual Studio 2019.
Severity Code Description Project File Line Suppression State
Error (active) E0513 a value of type "void *" cannot be assigned to an entity of type "c89thrd_start_data_win32 *" ConsoleApplication1 C:\Users\kenfal\source\repos\ConsoleApplication1\ConsoleApplication1\c89thread.h 345
Error C2440 '=': cannot convert from 'void *' to 'c89thrd_start_data_win32 *' ConsoleApplication1 C:\Users\kenfal\source\repos\ConsoleApplication1\ConsoleApplication1\c89thread.h 345
Message Conversion from 'void*' to pointer to non-'void' requires an explicit cast ConsoleApplication1 C:\Users\kenfal\source\repos\ConsoleApplication1\ConsoleApplication1\c89thread.h 345
The function c89mtx_unlock
is always returning an error on pthread due to a typo in its logic, these lines:
if (result == 0) {
return c89thrd_error;
}
it should have been actually result != 0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.