zlateski / zi_lib Goto Github PK
View Code? Open in Web Editor NEWgeneral purpose c++ library
Home Page: zi.mi.rs
general purpose c++ library
Home Page: zi.mi.rs
define macros are weird!
Hi!
Do I need to stop thread pools manually before using zi::all_threads::join_all()? Right now, when attempting to stop all threads, everyone appears to be waiting on a cv:
(gdb) info threads 15 Thread 0x7fffe57fa910 (LWP 22997) pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261 14 Thread 0x7fffe5ffb910 (LWP 22996) pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261 6 Thread 0x7fffee511910 (LWP 22988) pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261 5 Thread 0x7fffef513910 (LWP 22987) pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261 * 4 Thread 0x7fffeed12910 (LWP 22986) pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261 1 Thread 0x7ffff295b7a0 (LWP 22983) pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261 (gdb) thread apply all bt Thread 15 (Thread 0x7fffe57fa910 (LWP 22997)): #0 pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261 #1 0x0000000000426005 in zi::concurrency_::condition_variable::wait > (this=0x7fffe0069ca0, g=...) at include/zi/concurrency/pthread/condition_variable.hpp:67 #2 0x000000000051ff87 in zi::concurrency_::task_manager_impl, std::allocator > > >::run ( this=0x7fffe0069c00) at include/zi/concurrency/detail/task_manager_impl.hpp:319 #3 0x00000000005148cb in zi::concurrency_::runnable::execute (this=0x7fffe0069c00) at include/zi/concurrency/runnable.hpp:78 #4 0x000000000051920a in zi::concurrency_::detail::thread_info::run (this=0x7fffe0054700) at include/zi/concurrency/detail/thread_info.hpp:164 #5 0x00000000005176b6 in zi::concurrency_::thread_tpl::ENTRY (info=0x7fffe0054700) at include/zi/concurrency/pthread/thread.hpp:53 #6 0x00007ffff62daa04 in start_thread (arg=) at pthread_create.c:300 #7 0x00007ffff5898d4d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112 #8 0x0000000000000000 in ?? () Thread 14 (Thread 0x7fffe5ffb910 (LWP 22996)): #0 pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261 #1 0x0000000000426005 in zi::concurrency_::condition_variable::wait > (this=0x7fffe0069ca0, g=...) at include/zi/concurrency/pthread/condition_variable.hpp:67 #2 0x000000000051ff87 in zi::concurrency_::task_manager_impl, std::allocator > > >::run ( this=0x7fffe0069c00) at include/zi/concurrency/detail/task_manager_impl.hpp:319 #3 0x00000000005148cb in zi::concurrency_::runnable::execute (this=0x7fffe0069c00) at include/zi/concurrency/runnable.hpp:78 #4 0x000000000051920a in zi::concurrency_::detail::thread_info::run (this=0x7fffe0052260) at include/zi/concurrency/detail/thread_info.hpp:164 #5 0x00000000005176b6 in zi::concurrency_::thread_tpl::ENTRY (info=0x7fffe0052260) at include/zi/concurrency/pthread/thread.hpp:53 #6 0x00007ffff62daa04 in start_thread (arg=) at pthread_create.c:300 #7 0x00007ffff5898d4d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112 #8 0x0000000000000000 in ?? () Thread 6 (Thread 0x7fffee511910 (LWP 22988)): #0 pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261 #1 0x0000000000426005 in zi::concurrency_::condition_variable::wait > (this=0x7fffe006a7c0, g=...) at include/zi/concurrency/pthread/condition_variable.hpp:67 #2 0x000000000051ff87 in zi::concurrency_::task_manager_impl, std::allocator > > >::run ( this=0x7fffe006a720) at include/zi/concurrency/detail/task_manager_impl.hpp:319 #3 0x00000000005148cb in zi::concurrency_::runnable::execute (this=0x7fffe006a720) at include/zi/concurrency/runnable.hpp:78 #4 0x000000000051920a in zi::concurrency_::detail::thread_info::run (this=0x7fffe0060c40) at include/zi/concurrency/detail/thread_info.hpp:164 #5 0x00000000005176b6 in zi::concurrency_::thread_tpl::ENTRY (info=0x7fffe0060c40) at include/zi/concurrency/pthread/thread.hpp:53 #6 0x00007ffff62daa04 in start_thread (arg=) at pthread_create.c:300 #7 0x00007ffff5898d4d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112 #8 0x0000000000000000 in ?? () Thread 5 (Thread 0x7fffef513910 (LWP 22987)): #0 pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261 #1 0x0000000000426005 in zi::concurrency_::condition_variable::wait > (this=0x7fffe006a7c0, g=...) at include/zi/concurrency/pthread/condition_variable.hpp:67 #2 0x000000000051ff87 in zi::concurrency_::task_manager_impl, std::allocator > > >::run ( this=0x7fffe006a720) at include/zi/concurrency/detail/task_manager_impl.hpp:319 #3 0x00000000005148cb in zi::concurrency_::runnable::execute (this=0x7fffe006a720) at include/zi/concurrency/runnable.hpp:78 #4 0x000000000051920a in zi::concurrency_::detail::thread_info::run (this=0x7fffe005f640) at include/zi/concurrency/detail/thread_info.hpp:164 #5 0x00000000005176b6 in zi::concurrency_::thread_tpl::ENTRY (info=0x7fffe005f640) at include/zi/concurrency/pthread/thread.hpp:53 #6 0x00007ffff62daa04 in start_thread (arg=) at pthread_create.c:300 #7 0x00007ffff5898d4d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112 #8 0x0000000000000000 in ?? () Thread 4 (Thread 0x7fffeed12910 (LWP 22986)): #0 pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261 #1 0x0000000000426005 in zi::concurrency_::condition_variable::wait > (this=0x7fffe006a7c0, g=...) at include/zi/concurrency/pthread/condition_variable.hpp:67 #2 0x000000000051ff87 in zi::concurrency_::task_manager_impl, std::allocator > > >::run ( this=0x7fffe006a720) at include/zi/concurrency/detail/task_manager_impl.hpp:319 #3 0x00000000005148cb in zi::concurrency_::runnable::execute (this=0x7fffe006a720) at include/zi/concurrency/runnable.hpp:78 #4 0x000000000051920a in zi::concurrency_::detail::thread_info::run (this=0x7fffe005ff80) at include/zi/concurrency/detail/thread_info.hpp:164 #5 0x00000000005176b6 in zi::concurrency_::thread_tpl::ENTRY (info=0x7fffe005ff80) at include/zi/concurrency/pthread/thread.hpp:53 #6 0x00007ffff62daa04 in start_thread (arg=) at pthread_create.c:300 #7 0x00007ffff5898d4d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112 #8 0x0000000000000000 in ?? () Thread 1 (Thread 0x7ffff295b7a0 (LWP 22983)): #0 pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261 #1 0x0000000000426005 in zi::concurrency_::condition_variable::wait > (this=0xea2840, g=...) at include/zi/concurrency/pthread/condition_variable.hpp:67 ---Type to continue, or q to quit--- #2 0x00000000004260fb in zi::concurrency_::detail::all_threads_data::join_all (this=0xea2800) at include/zi/concurrency/detail/all_threads_data.hpp:89 #3 0x0000000000540031 in zi::concurrency_::all_threads::join_all () at include/zi/concurrency/detail/all_threads.hpp:57 #4 0x000000000053f6de in OmProject::Close () at src/project/omProject.cpp:147 #5 0x00000000004df3e4 in MainWindow::closeProjectIfOpen (this=0x7fffffffe4d0) at src/gui/mainwindow.cpp:192 #6 0x00000000004df486 in MainWindow::openRecentFile (this=0x7fffffffe4d0) at src/gui/mainwindow.cpp:211 #7 0x0000000000673172 in MainWindow::qt_metacall (this=0x7fffffffe4d0, _c=QMetaObject::InvokeMetaMethod, _id=4, _a=0x7fffffffcfd0) at build/moc_mainwindow.cpp:102 #8 0x00007ffff68f919f in QMetaObject::activate (sender=0xf36010, m=, local_signal_index=, argv=0xffffffffffffffff) at /home/purcaro.local/omni.staging/external/srcs/qt-everywhere-opensource-src-4.6.2/src/corelib/kernel/qobject.cpp:3285 #9 0x00007ffff6e55fe2 in QAction::triggered (this=0xea2844, _t1=false) at .moc/release-shared/moc_qaction.cpp:257 #10 0x00007ffff6e5804f in QAction::activate (this=0xf36010, event=) at /home/purcaro.local/omni.staging/external/srcs/qt-everywhere-opensource-src-4.6.2/src/gui/kernel/qaction.cpp:1255 #11 0x00007ffff7272445 in QMenuPrivate::activateCausedStack (this=, causedStack=..., action=0xf36010, action_e=QAction::Trigger, self=24) at /home/purcaro.local/omni.staging/external/srcs/qt-everywhere-opensource-src-4.6.2/src/gui/widgets/qmenu.cpp:1011 #12 0x00007ffff7277ed2 in QMenuPrivate::activateAction (this=0xf233d0, action=0xf36010, action_e=QAction::Trigger, self=) at /home/purcaro.local/omni.staging/external/srcs/qt-everywhere-opensource-src-4.6.2/src/gui/widgets/qmenu.cpp:1103 #13 0x00007ffff6eac852 in QWidget::event (this=0xf23120, event=0x7fffffffda10) at /home/purcaro.local/omni.staging/external/srcs/qt-everywhere-opensource-src-4.6.2/src/gui/kernel/qwidget.cpp:7998 #14 0x00007ffff7279ffb in QMenu::event (this=0xf23120, e=0x7fffffffda10) at /home/purcaro.local/omni.staging/external/srcs/qt-everywhere-opensource-src-4.6.2/src/gui/widgets/qmenu.cpp:2414 #15 0x00007ffff6e5b83c in QApplicationPrivate::notify_helper (this=0xeae8f0, receiver=0xf23120, e=0x7fffffffda10) at /home/purcaro.local/omni.staging/external/srcs/qt-everywhere-opensource-src-4.6.2/src/gui/kernel/qapplication.cpp:4300 #16 0x00007ffff6e623d1 in QApplication::notify (this=0xeaa190, receiver=0xf23120, e=0x7fffffffda10) at /home/purcaro.local/omni.staging/external/srcs/qt-everywhere-opensource-src-4.6.2/src/gui/kernel/qapplication.cpp:3865 #17 0x00007ffff68e6cdc in QCoreApplication::notifyInternal (this=0xeaa190, receiver=0xf23120, event=0x7fffffffda10) at /home/purcaro.local/omni.staging/external/srcs/qt-everywhere-opensource-src-4.6.2/src/corelib/kernel/qcoreapplication.cpp:704 #18 0x00007ffff6e61736 in QCoreApplication::sendEvent (receiver=0xf23120, event=0x7fffffffda10, alienWidget=0x0, nativeWidget=0xf23120, buttonDown=, lastMouseReceiver=, spontaneous=true) at ../../include/QtCore/../../../../srcs/qt-everywhere-opensource-src-4.6.2/src/corelib/kernel/qcoreapplication.h:215 #19 QApplicationPrivate::sendMouseEvent (receiver=0xf23120, event=0x7fffffffda10, alienWidget=0x0, nativeWidget=0xf23120, buttonDown=, lastMouseReceiver=, spontaneous=true) at /home/purcaro.local/omni.staging/external/srcs/qt-everywhere-opensource-src-4.6.2/src/gui/kernel/qapplication.cpp:2965 #20 0x00007ffff6edaa65 in QETWidget::translateMouseEvent (this=0xf23120, event=) at /home/purcaro.local/omni.staging/external/srcs/qt-everywhere-opensource-src-4.6.2/src/gui/kernel/qapplication_x11.cpp:4302 #21 0x00007ffff6ed93cd in QApplication::x11ProcessEvent (this=, event=0x7fffffffe2f0) at /home/purcaro.local/omni.staging/external/srcs/qt-everywhere-opensource-src-4.6.2/src/gui/kernel/qapplication_x11.cpp:3501 #22 0x00007ffff6f01c99 in QEventDispatcherX11::processEvents (this=, flags=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece. ) at /home/purcaro.local/omni.staging/external/srcs/qt-everywhere-opensource-src-4.6.2/src/gui/kernel/qeventdispatcher_x11.cpp:132 #23 0x00007ffff68e5812 in QEventLoop::processEvents (this=, flags=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece. ) at /home/purcaro.local/omni.staging/external/srcs/qt-everywhere-opensource-src-4.6.2/src/corelib/kernel/qeventloop.cpp:149 #24 0x00007ffff68e5bec in QEventLoop::exec (this=0x7fffffffe470, flags=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece. ) at /home/purcaro.local/omni.staging/external/srcs/qt-everywhere-opensource-src-4.6.2/src/corelib/kernel/qeventloop.cpp:201 #25 0x00007ffff68e7d09 in QCoreApplication::exec () at /home/purcaro.local/omni.staging/external/srcs/qt-everywhere-opensource-src-4.6.2/src/corelib/kernel/qcoreapplication.cpp:981 #26 0x00000000004d9ed5 in Omni::runGUI (this=0x7fffffffe640) at src/main.cpp:105 #27 0x00000000004d9b67 in Omni::Run (this=0x7fffffffe640) at src/main.cpp:48 #28 0x00000000004d2f6d in main (argc=1, argv=0x7fffffffe758) at src/main.cpp:133 (gdb)
src/mesh/ziMeshingChunk.cpp: In member function 'virtual void ziMeshingChunk::run()': src/mesh/ziMeshingChunk.cpp:38: error: invalid conversion from '_opaque_pthread_t*' to 'uint64_t'
due to
const uint64_t threadId = zi::this_thread::id();
build/...lumeData.o: In function `zi::zlog::ERROR_ZiLOG_memmap_already_defined()': /usr/include/c++/4.4/bits/char_traits.h:258: multiple definition of `zi::zlog::ERROR_ZiLOG_memmap_already_defined()'
Hi!
I'm converting over to zlog; it might be nice to be able to use printf w/ zlog, as in zi_lib_v1, like:
ZiLOG(INFO, FirstLog).printf("%0.5f", 1.23);
Night!
like std::hex, std::dec;, etc:
include/zi/utility/detail/get_instance.hpp: In instantiation of ‘zi::detail::get_instance_::get_instance’: include/zi/utility/is_printable.hpp:68: instantiated from ‘zi::detail::is_printable_::is_printable’ src/mesh/ziMeshingChunk.cpp:48: instantiated from here include/zi/utility/detail/get_instance.hpp:34: error: variable ‘static_instance’ has function type
free p missing in log_printf and string_printf?
Hi!
build error when using library:
In file included from ../external/zi_lib/zi/concurrency/pthread/mutex_tpl.hpp:26, from ../external/zi_lib/zi/concurrency/pthread/mutex_types.hpp:22, from ../external/zi_lib/zi/concurrency/mutex.hpp:25, from ../external/zi_lib/zi/concurrency/barrier.hpp:23, from ../external/zi_lib/zi/concurrency/concurrency.hpp:22, from ../external/zi_lib/zi/concurrency.hpp:22, ../external/zi_lib/zi/concurrency/pthread/mutex_initializers.hpp: In static member function 'static void zi::concurrency_::mutex_initializer::initialize(pthread_mutex_t&)': ../external/zi_lib/zi/concurrency/pthread/mutex_initializers.hpp:48: error: 'PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP' was not declared in this scope ../external/zi_lib/zi/concurrency/pthread/mutex_initializers.hpp: In static member function 'static void zi::concurrency_::mutex_initializer::initialize(pthread_mutex_t&)': ../external/zi_lib/zi/concurrency/pthread/mutex_initializers.hpp:58: error: 'PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' was not declared in this scope In file included from ../external/zi_lib/zi/concurrency/condition_variable.hpp:25, from ../external/zi_lib/zi/concurrency/barrier.hpp:24, from ../external/zi_lib/zi/concurrency/concurrency.hpp:22, from ../external/zi_lib/zi/concurrency.hpp:22,
GCC:
macpro:omni purcaro$ gcc -v Using built-in specs. Target: i686-apple-darwin10 Configured with: /var/tmp/gcc/gcc-5646.1~2/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 Thread model: posix gcc version 4.2.1 (Apple Inc. build 5646) (dot 1)
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.