GCD : How to check if the task is runnig
I'm running the task using following code,

    mTimerForImageUpload = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
    if (mTimerForImageUpload) {
        dispatch_source_set_timer(mTimerForImageUpload, dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * uploadCheckInterval), NSEC_PER_SEC * uploadCheckInterval, leeway);
        dispatch_source_set_event_handler(mTimerForImageUpload, ^{
            [self uploadData];
        });
        dispatch_resume(mTimerForImageUpload);
    }

Basically I want to have only one running instance of the `uploadData` method at the same time. I.e. if the task is still running I dont want to run new thread, but want to wait until it finishes.

Any ideas how to do this ? 
GCD : How to check if the task is runnig
===

I'm running the task using following code,

    mTimerForImageUpload = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
    if (mTimerForImageUpload) {
        dispatch_source_set_timer(mTimerForImageUpload, dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * uploadCheckInterval), NSEC_PER_SEC * uploadCheckInterval, leeway);
        dispatch_source_set_event_handler(mTimerForImageUpload, ^{
            [self uploadData];
        });
        dispatch_resume(mTimerForImageUpload);
    }

Basically I want to have only one running instance of the `uploadData` method at the same time. I.e. if the task is still running I dont want to run new thread, but want to wait until it finishes.

Any ideas how to do this ? 