Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incomplete definition of type 'struct thpool_' #64

Open
jti-lanl opened this issue Nov 30, 2017 · 1 comment
Open

incomplete definition of type 'struct thpool_' #64

jti-lanl opened this issue Nov 30, 2017 · 1 comment

Comments

@jti-lanl
Copy link

The usage shown in the readme (compiling thpool.c along with myapp.c) is fine for building applications, but fails for the case of generating the .o for my_library_component.c, which has a struct thpool_* variable inside.

I presume the reason for hiding the definition of struct thpool_ is that, in order to expose it, you'd have to expose some of the other structs as well, and you want to keep those definitions private. But this seems to result in some pretty awkward build semantics. Wouldn't it make sense to just expose those structs, so thpool.c could just be another .o, as we build our own library that uses C-Thread-Pool internally?

Or, alternatively, threadpool could just be an opaque (i.e. void*) handle.

@jti-lanl
Copy link
Author

I think you could insure compiler type-checking of arguments, while also allowing complete definition in the .h, without exposing your internal structs, yet still passing only a pointer-sized value, by doing something like this:

typedef struct { void* dat; } threadpool;

... then casting the value of tp.datinside your functions.

jti-lanl added a commit to mar-file-system/GUFI that referenced this issue Mar 21, 2018
Added C-Thread-Pool as a submodule, based on a forked version that we
control.  This was needed to allow us to resolve
Pithikos/C-Thread-Pool#64, which we do in the
branch "lanl".  When we're comfortable with our version, we can issue a
pull-request.

Pulled .h files out of the .c support files.

The Makefile then builds libgufi.a from bf, structq, utils, dbutils, and
thpool.o (from the submodule).

Apps bfwi, bfti, and bfq, are then linked against the library.

Build everything like this:

  make clean   [optional]
  make

[Merge branch 'jti' into gary_merge_jti]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant