Commit Graph

45 Commits

Author SHA1 Message Date
Paul Davis 32b41037b5 libpbd: do not use debug transmitter inside BaseUI::signal_new_request() to avoid recursion 2022-06-13 13:43:31 -06:00
Paul Davis 968533cc23 (re)add mechanism for a callback in any glib event loop executed before the loop "executes"
This is based on code from earlier commits that were later reversed, but we need some mechanism
to ensure that threads have a thread local tempo map ptr set. The big difference is that this
time we do not implement this for all instances of an AbstractUI - implementation is left to
each thread/event loop
2022-05-16 15:24:52 -06:00
Robin Gareus 84c51a1411
Fix BaseUI x-thread signal vs thread-start race
Control surfaces c'tor usually subscribe to signals e.g.
PortConnectedOrDisconnected. This happens after the parent BaseUI
is created, but before set_active() -> BaseUI::run() is called.

At this point in time there is no run_loop thread.

There are two options to handle AbstractUI::call_slot():

 A. Queue the event in the event-loop, using the thread-local
    request buffer of the caller. Then hope the BaseUI
    thread is started, and calls ::handle_ui_requests() before
    the memory pool runs out of space.

 B. Handle the event in the calling thread. -- This may not be
    rt-safe and may call functions with locks held by the caller.
    It will however not accumulate events.

This takes approach (B). If _run_loop_thread is NULL, directly
handle the signal.

In the past, prior to 50abcc74b5, approach (A) was taken.
NULL never matched Glib::Threads::Thread::self().

This also reverts a prior attempt (e417495505) to address this issue.
2022-03-02 21:19:12 +01:00
Robin Gareus e417495505
Fix possible race (BaseUI creation vs x-thread signal-emission)
When a BaseUI is being created, signals can arrive before the
_run_loop_thread is running, which can trigger an assert in
BaseUI::caller_is_self().
2022-03-01 17:19:20 +01:00
Robin Gareus 50abcc74b5
Replace Glib::Threads with PBD::Thread (2/2) 2022-03-01 01:34:35 +01:00
Paul Davis 9e763c2672 remove all dangling event-loop-precall code 2021-10-11 17:48:53 -06:00
Paul Davis e057088195 remove unused, empty glib event source/callback code (was from an experiment during nutempo2 development) 2021-09-04 07:39:27 -06:00
Paul Davis b7d22508fa Add blib event callback to BaseUI, with a virtual method to be overridden by derived classes. 2021-08-13 12:51:30 -06:00
Robin Gareus bf43c8d2d4
Set thread names 2021-06-30 17:15:27 +02:00
Robin Gareus 6e82f3669f
Correctly set ctrl-surface thread priority 2021-06-10 03:17:55 +02:00
Paul Davis 560994c97a repeat baf0cdcbef but for BaseUI, thus covering all control protocols 2020-01-05 11:40:59 -07:00
Robin Gareus 0301c47f6b
Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
Robin Gareus 229c9584bf Add a PBD API to set pthread priority 2017-08-29 17:25:23 +02:00
Robin Gareus 8374e23014 Add API to set thread-priority (for ctrl-surfaces) 2017-08-05 01:28:11 +02:00
Paul Davis cf52d6e4b4 enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h 2016-07-14 14:45:23 -04:00
Paul Davis bcb865c235 improved debug trace messages from BaseUI class 2016-01-12 22:11:44 -05:00
Paul Davis f369f33955 move BaseUI::_name into EventLoop; rename access method in EventLoop as event_loop_name() to clarify usage 2015-12-12 11:12:10 -05:00
Robin Gareus 22b07e0233 NOOP, remove trailing tabs/whitespace. 2015-10-05 16:17:49 +02:00
Paul Davis 4dc63966f0 globally remove all trailing whitespace from ardour code base.
Paul Davis was responsible for introducing almost all of this.
2015-10-04 14:51:05 -04:00
Paul Davis 7ab3da66b5 fix up BaseUI to use crossthreadchannel on all platforms 2014-12-03 21:11:02 -05:00
John Emmas 350ed31655 Remaining changes needed for building libpdb on Windows (except for adding the extra JE source modules) 2013-07-17 08:08:46 +01:00
John Emmas 7b480eaa27 Windows (compiler specific) includes for libpbd 2013-07-16 18:00:49 +01:00
Paul Davis 4adb2f97cc Use timeout source to process ui requests on windows
Using a timeout source to process ui events/requests is suboptimal
but it works for the moment. Have to use g_source functions as glibmm
functions are not thread safe AFAIK.

Behaviour should be exactly the same on unix.
2013-07-11 12:56:35 -04:00
Paul Davis 7626cd68ac Hide UI request mechanism from inheriting classes 2013-07-11 12:52:46 -04:00
Paul Davis b9fa882c56 Use PBD::pthread_name in debug output instead of pthread_self 2013-07-11 12:01:17 -04:00
Paul Davis 3cd8138a41 convert from Glib:: to Glib::Threads for all thread-related API
git-svn-id: svn://localhost/ardour2/branches/3.0@13084 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-07-25 17:48:55 +00:00
Paul Davis 1e0fd01815 drop boost::signals2 and replace with carl's solution which continues to rely on boost::function and boost::bind but alters two important semantics of signals2: (1) when a Connection object is disconnected, the slot ("functor") associated with the connection is destroyed immediately, unlike signals2 where this is deferred to a subsequent connect/emit call on the signal (2) if one functor called by the signal disconnects another Connection, the functor represented by the Connection will NOT be called during the current signal emission (signals2 copies the slot list at the start of emission and calls everything in the slot list). this change fixes some very nasty crashes apparently caused by boost::signals2 assuming that the memory referenced by a functor remains valid after a disconnect (google will show other developers who had issues with this).
git-svn-id: svn://localhost/ardour2/branches/3.0@12265 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-05-14 17:18:48 +00:00
Paul Davis 37969d837e remove virtual inheritance of sigc::trackable by Receiver and AbstractUI<T>, done by changing Gtkmm2ext::UI to use composition (HAS-A) rather than inheritance (IS-A) for Receiver; use correct synchronization when starting up a BseUI event loop thread so that tests that start/stop quickly do not encounter a race condition
git-svn-id: svn://localhost/ardour2/branches/3.0@12264 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-05-14 17:07:53 +00:00
Carl Hetherington c8f6f87ea7 Fix critical glib warning if a BaseUI is quit without
being started.


git-svn-id: svn://localhost/ardour2/branches/3.0@12219 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-05-09 10:34:00 +00:00
Paul Davis d5e14b3d91 eventloop and abstractui debugging, lots more commenting on abstractui/eventloop implementation; minor tweaks elsewhere
git-svn-id: svn://localhost/ardour2/branches/3.0@12076 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-04-24 16:45:38 +00:00
Paul Davis a9d77d1a70 remove various debugging output
git-svn-id: svn://localhost/ardour2/branches/3.0@12070 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-04-24 02:35:33 +00:00
Paul Davis 33140f3267 add support for IP MIDI (multicast MIDI over IP UDP sockets) to ardour and use it if requested inside MCP code. required renaming the pre-existing MIDI::Port as MIDI:JackMIDIPort - MIDI::Port becomes the base type for both JackMIDIPort and IPMIDIPort
git-svn-id: svn://localhost/ardour2/branches/3.0@12069 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-04-24 02:28:51 +00:00
Carl Hetherington 02cfe41bff Update region peak amplitude when the region is trimmed (#3931).
git-svn-id: svn://localhost/ardour2/branches/3.0@9276 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-04-04 12:21:26 +00:00
Paul Davis 109acd1568 MIDI binding maps make their debut
git-svn-id: svn://localhost/ardour2/branches/3.0@6408 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-12-28 16:49:44 +00:00
Paul Davis f450df300c fully implement and deploy explicit x-thread signal connection syntax (testing comes next)
git-svn-id: svn://localhost/ardour2/branches/3.0@6379 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-12-21 18:23:07 +00:00
Paul Davis 90d6916ca3 restore rec-enable, solo & mute functionality; remove all Global*Command cruft; reimplement momentary solo&mute; refactor session RT event stuff to be even cleaner and finally compatible with everything-is-a-UI idea ; make all UIs derive from a primitive type that pprovides only void call_slot (sigc::slot<void>) as a way to execute arbitrary code in the UI thread
git-svn-id: svn://localhost/ardour2/branches/3.0@6338 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-12-10 17:45:18 +00:00
Paul Davis b8b55ef003 OSC is now driven by an event loop; fix up lifetime mgmt of Glib::Source to workaround bug in Glib
git-svn-id: svn://localhost/ardour2/branches/3.0@6329 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-12-09 18:37:06 +00:00
Paul Davis c38e02285f major design changes: use glib event loop for MIDI thread/UI; rework design of BaseUI and AbstractUI; solo & mute are both temporarily broken; OSC control up next; may segfault during exit
git-svn-id: svn://localhost/ardour2/branches/3.0@6328 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-12-09 03:05:14 +00:00
David Robillard e0aaed6d65 *** NEW CODING POLICY ***
All #include statements that include a header that is a part of a library
bundled with ardour MUST use quotes, not angle brackets.

Do this:

#include "ardour/types.h"

NOT this:

#include <ardour/types.h>

Rationale:

This is best practice in general, to ensure we include the local version
and not the system version.  That quotes mean "local" (in some sense)
and angle brackets mean "system" (in some sense) is a ubiquitous
convention and IIRC right in the C spec somewhere.

More pragmatically, this is required by (my) waf (stuff) for dependencies
to work correctly.  That is:

!!! FAILURE TO DO THIS CAN RESULT IN BROKEN BUILDS !!!

Failure to comply is punishable by death by torture. :)

P.S. It's not that dramatic in all cases, but this (in combination with some
GCC flags specific to the include type) is the best way I have found to be
absolutely 100% positive the local ones are being used (and we definitely
want to be absolutely 100% positive on that one).


git-svn-id: svn://localhost/ardour2/branches/3.0@4655 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-02-25 18:26:51 +00:00
Paul Davis 68e943265e merge from 2.0-ongoing @ 3581
git-svn-id: svn://localhost/ardour2/branches/3.0@3711 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-09-10 15:03:30 +00:00
Paul Davis 449aab3c46 rollback to 3428, before the mysterious removal of libs/* at 3431/3432
git-svn-id: svn://localhost/ardour2/branches/3.0@3435 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-06-02 21:41:35 +00:00
Doug McLain 9c0d7d72d7 remove empty sigc++2 directory
git-svn-id: svn://localhost/ardour2/branches/3.0@3432 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-06-02 05:02:28 +00:00
David Robillard da45f489dd Fixes for GCC 4.3.
git-svn-id: svn://localhost/ardour2/branches/3.0@3303 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-05-02 18:35:05 +00:00
Paul Davis 87726495c3 Merged changes from trunk 1699:1751 into 2.1-staging
git-svn-id: svn://localhost/ardour2/branches/2.1-staging@1752 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-04-26 20:54:31 +00:00
Taybin Rutkin 481f7c3965 Fixed i18n system.
Renamed pbd3 back to pbd, since it's version 4.1 now.
Very minor fixes


git-svn-id: svn://localhost/ardour2/trunk@656 d708f5d6-7413-0410-9779-e7cbd77b26cf
2006-06-29 22:21:30 +00:00