using namespace std;
using namespace ARDOUR;
+using namespace PBD;
Source::Source (Session& s, DataType type, const string& name, Flag flags)
: SessionObject(s, name)
, _type(type)
, _flags(flags)
, _timeline_position(0)
+ , _use_count (0)
{
_analysed = false;
_timestamp = 0;
, _type(DataType::AUDIO)
, _flags (Flag (Writable|CanRename))
, _timeline_position(0)
+ , _use_count (0)
{
_timestamp = 0;
_analysed = false;
Source::~Source ()
{
- DEBUG_TRACE (DEBUG::Destruction, string_compose ("Source %1 destructor\n", _name));
+ DEBUG_TRACE (DEBUG::Destruction, string_compose ("Source %1 destructor %2\n", _name, this));
}
-
void
Source::fix_writable_flags ()
{
}
}
+void
+Source::inc_use_count ()
+{
+ g_atomic_int_inc (&_use_count);
+}
+
+void
+Source::dec_use_count ()
+{
+#ifndef NDEBUG
+ gint oldval = g_atomic_int_exchange_and_add (&_use_count, -1);
+ if (oldval <= 0) {
+ cerr << "Bad use dec for " << name() << endl;
+ abort ();
+ }
+ assert (oldval > 0);
+#else
+ g_atomic_int_exchange_and_add (&_use_count, -1);
+#endif
+}