X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=libview%2Fev-job-scheduler.c;h=85e5adda30ce5f5d295dc40c60322298b689bddf;hb=ab0edaffd2f1790ec8ac7ac17f90e0a8007b92cd;hp=900714eec77c5f7920a5e6b0bdcc6b9ca0b75485;hpb=68d0fc3c59185065d9694ba3f8cb2665b984eb9f;p=evince.git diff --git a/libview/ev-job-scheduler.c b/libview/ev-job-scheduler.c index 900714ee..85e5adda 100644 --- a/libview/ev-job-scheduler.c +++ b/libview/ev-job-scheduler.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "ev-debug.h" @@ -30,6 +30,8 @@ typedef struct _EvSchedulerJob { G_LOCK_DEFINE_STATIC(job_list); static GSList *job_list = NULL; +static volatile EvJob *running_job = NULL; + static gpointer ev_job_thread_proxy (gpointer data); static void ev_scheduler_thread_job_cancelled (EvSchedulerJob *job, GCancellable *cancellable); @@ -179,9 +181,13 @@ ev_job_thread (EvJob *job) do { if (g_cancellable_is_cancelled (job->cancellable)) result = FALSE; - else + else { + g_atomic_pointer_set (&running_job, job); result = ev_job_run (job); + } } while (result); + + g_atomic_pointer_set (&running_job, NULL); } static gboolean @@ -303,3 +309,8 @@ ev_job_scheduler_update_job (EvJob *job, } } +EvJob * +ev_job_scheduler_get_running_thread_job (void) +{ + return g_atomic_pointer_get (&running_job); +}