~noskcaj/ubuntu/trusty/tumbler/0.1.30

« back to all changes in this revision

Viewing changes to tumblerd/tumbler-lifecycle-manager.c

  • Committer: Package Import Robot
  • Author(s): Yves-Alexis Perez, Yves-Alexis Perez, Lionel Le Folgoc
  • Date: 2013-05-22 00:27:44 UTC
  • mfrom: (4.1.5)
  • Revision ID: package-import@ubuntu.com-20130522002744-aolnhslar437lwv7
Tags: 0.1.29-1
[ Yves-Alexis Perez ]
* New upstream release.
* debian/control:
  - update gstreamer build-dep to libgstreamer1.0-dev and
    libgstreamer-plugins-base1.0-dev.
* debian/rules:
  - enable all hardening flags.

[ Lionel Le Folgoc ]
* New upstream release (0.1.27):
  - re-enable all plugins since there's now a priority mechanism to choose
    the preferred ones.
* debian/rules: drop --disable-ffmpeg-thumbnailer from configure.
* debian/control:
  - readd libffmpegthumbnailer-dev to b-deps to build the ffmpeg thumbnailer
    plugin.
  - add libcurl4-gnutls-dev to b-deps to build the cover thumbnailer plugin
  - update the long description of tumbler-plugins-extra to mention the new
    plugins.
* debian/tumbler-plugins-extra.install: ship the new plugins.
* debian/tumbler-common.install: ship the new rc file.
* debian/libtumbler-1-0.symbols: updated for the new symbols.
* debian/copyright: refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include <tumbler/tumbler.h>
30
30
 
31
31
#include <tumblerd/tumbler-lifecycle-manager.h>
 
32
#include <tumblerd/tumbler-utils.h>
32
33
 
33
34
 
34
35
 
58
59
{
59
60
  GObject __parent__;
60
61
 
61
 
  GMutex *lock;
 
62
  TUMBLER_MUTEX (lock);
62
63
 
63
64
  guint   timeout_id;
64
65
  guint   component_use_count;
103
104
static void
104
105
tumbler_lifecycle_manager_init (TumblerLifecycleManager *manager)
105
106
{
106
 
  manager->lock = g_mutex_new ();
 
107
  tumbler_mutex_create (manager->lock);
107
108
  manager->timeout_id = 0;
108
109
  manager->component_use_count = 0;
109
110
  manager->shutdown_emitted = FALSE;
116
117
{
117
118
  TumblerLifecycleManager *manager = TUMBLER_LIFECYCLE_MANAGER (object);
118
119
 
119
 
  g_mutex_free (manager->lock);
 
120
  tumbler_mutex_free (manager->lock);
120
121
 
121
122
  (*G_OBJECT_CLASS (tumbler_lifecycle_manager_parent_class)->finalize) (object);
122
123
}
128
129
{
129
130
  g_return_val_if_fail (TUMBLER_IS_LIFECYCLE_MANAGER (manager), FALSE);
130
131
 
131
 
  g_mutex_lock (manager->lock);
 
132
  tumbler_mutex_lock (manager->lock);
132
133
 
133
134
  /* reschedule the timeout if one of the components is still in use */
134
135
  if (manager->component_use_count > 0)
135
136
    {
136
 
      g_mutex_unlock (manager->lock);
 
137
      tumbler_mutex_unlock (manager->lock);
137
138
      return TRUE;
138
139
    }
139
140
 
147
148
   * reschedule the timeout */
148
149
  manager->shutdown_emitted = TRUE;
149
150
 
150
 
  g_mutex_unlock (manager->lock);
 
151
  tumbler_mutex_unlock (manager->lock);
151
152
 
152
153
  return FALSE;
153
154
}
167
168
{
168
169
  g_return_if_fail (TUMBLER_IS_LIFECYCLE_MANAGER (manager));
169
170
 
170
 
  g_mutex_lock (manager->lock);
 
171
  tumbler_mutex_lock (manager->lock);
171
172
 
172
173
  /* ignore if there already is a timeout scheduled */
173
174
  if (manager->timeout_id > 0)
174
175
    {
175
 
      g_mutex_unlock (manager->lock);
 
176
      tumbler_mutex_unlock (manager->lock);
176
177
      return;
177
178
    }
178
179
 
181
182
                           (GSourceFunc) tumbler_lifecycle_manager_timeout, 
182
183
                           manager);
183
184
 
184
 
  g_mutex_unlock (manager->lock);
 
185
  tumbler_mutex_unlock (manager->lock);
185
186
}
186
187
 
187
188
 
193
194
  g_return_val_if_fail (TUMBLER_IS_LIFECYCLE_MANAGER (manager), FALSE);
194
195
  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
195
196
 
196
 
  g_mutex_lock (manager->lock);
 
197
  tumbler_mutex_lock (manager->lock);
197
198
 
198
199
  /* if the shutdown signal has been emitted, there's nothing 
199
200
   * we can do to prevent a shutdown anymore */
200
201
  if (manager->shutdown_emitted)
201
202
    {
202
 
      g_mutex_unlock (manager->lock);
 
203
      tumbler_mutex_unlock (manager->lock);
203
204
 
204
205
      if (error != NULL)
205
206
        {
220
221
                           (GSourceFunc) tumbler_lifecycle_manager_timeout, 
221
222
                           manager);
222
223
 
223
 
  g_mutex_unlock (manager->lock);
 
224
  tumbler_mutex_unlock (manager->lock);
224
225
 
225
226
  return TRUE;
226
227
}
232
233
{
233
234
  g_return_if_fail (TUMBLER_IS_LIFECYCLE_MANAGER (manager));
234
235
 
235
 
  g_mutex_lock (manager->lock);
 
236
  tumbler_mutex_lock (manager->lock);
236
237
 
237
238
  manager->component_use_count += 1;
238
239
  
239
 
  g_mutex_unlock (manager->lock);
 
240
  tumbler_mutex_unlock (manager->lock);
240
241
}
241
242
 
242
243
 
246
247
{
247
248
  g_return_if_fail (TUMBLER_IS_LIFECYCLE_MANAGER (manager));
248
249
 
249
 
  g_mutex_lock (manager->lock);
 
250
  tumbler_mutex_lock (manager->lock);
250
251
  
251
252
  /* decrement the use count, make sure not to drop below zero */
252
253
  if (manager->component_use_count > 0)
253
254
    manager->component_use_count -= 1;
254
255
  
255
 
  g_mutex_unlock (manager->lock);
 
256
  tumbler_mutex_unlock (manager->lock);
256
257
}