Comments (8)
so it looks like threaad local storage isn't supported on OSX due to the executable format - most people suggest implementing your own by tying an object to the creation of threads. I was planning on doing this anyway to make the solution more clean but hadn't gotten around to making a Threads wrapper in Cello. This is probably a good time to start.
from cello.
Hello,
In order to make the Exception objects thread safe, libCello used Thread Local Storage (TLS) to declare some global variable (__thread keyword)
On OSX, Clang/GCC do not support TLS. As @orangeduck says, it's a work in progress.
If you don't want to create multi threads application or use exceptions, I suggest you to remove the __thread keyword
Bertrand
from cello.
@orangeduck Instead of writing our own Thread wrapper, why not using pthread library ?
from cello.
Having tried that: make check
then fails with ~19 errors:
error: nested functions are disabled, use -fnested-functions to re-enable
After ./configure CC="gcc -fnested-functions"
, make
fails:
ld: -allow_stack_execute option can only be used when linking a main executable
A few people are raising other issues about post-build problems on OS X. Any chance you can get one of them to contribute a set of build instructions that result in a [vaguely] working library? I don't believe I'll succeed just blundering from error to error.
from cello.
@bcachet That was my intention for posix systems but also would be nice to have winthread supported too. Then both need to wrapped in a Cello like "Thread" type.
from cello.
@garthk please add -fnested-functions to the compile flags inside tests/Makefile.am which will look like this:
check_PROGRAMS = tests
tests_SOURCES = \
core.c \
data.c \
exception.c \
functional.c \
memory.c \
ptest.c \
test.c
tests_CPPFLAGS = -I$(top_srcdir)/tests
tests_CFLAGS = -std=gnu99 -Wall -Werror -Wextra -Wno-unused -fnested-functions
tests_LDFLAGS = -lCello
TESTS = tests
or add ADD_DEFINITIONS(-fnested-functions) to tests/CMakeLists.txt and use cmake to generate your build environment
Bertrand
from cello.
The portable way would be to use libpthread with pthread_getspecific() or use C11's thread.h _Thread_local. But I doubt the last C standard is shipped with OSX... What about ifdefs and wrappers depending on features found?
from cello.
Indeed this is the method I ended up using. Should be fixed in latest commit.
from cello.
Related Issues (20)
- Unexpected GC behavior with Tuple HOT 5
- Make install should use "install --mode=..." instead of "cp" HOT 2
- make install doesn't install the dynamic library
- How do one "extends" a type? HOT 3
- error: cast to pointer from integer of different size HOT 2
- pop semantics? HOT 3
- Append Char HOT 2
- MacOS: __dyld section not supported HOT 1
- Abstracting a scripting language's internal value types using Cello HOT 1
- Feature request : Lua->Cello transpiler
- Missing Git tag for 2.1.0 release HOT 2
- Can I make a wrapper for other languages?
- Add vcpkg installation instructions
- Question about Array
- Doesn't work with Emscripten HOT 2
- is the project alive? can I use it in my product? who develops forks based on Cello? HOT 3
- Moving objects between threads HOT 1
- Failed to compile on GCC 8.1.0
- Can you do a comparison to Nim and Nelua?
- new release? HOT 2
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 cello.