Git Product home page Git Product logo

Comments (8)

orangeduck avatar orangeduck commented on July 18, 2024

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.

bcachet avatar bcachet commented on July 18, 2024

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.

bcachet avatar bcachet commented on July 18, 2024

@orangeduck Instead of writing our own Thread wrapper, why not using pthread library ?

from cello.

garthk avatar garthk commented on July 18, 2024

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.

orangeduck avatar orangeduck commented on July 18, 2024

@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.

bcachet avatar bcachet commented on July 18, 2024

@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.

radare avatar radare commented on July 18, 2024

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.

orangeduck avatar orangeduck commented on July 18, 2024

Indeed this is the method I ended up using. Should be fixed in latest commit.

from cello.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.