syncop: synctask shouldn't yawn, it could miss a 'wake'
Change-Id: I7731fd33ca0c925cc52f8d105275b44fc625a1e2 BUG: 948686 Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/5058 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
This commit is contained in:
parent
2eed9c7856
commit
16b5ec6712
@ -100,21 +100,6 @@ synctask_yield (struct synctask *task)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
synctask_yawn (struct synctask *task)
|
||||
{
|
||||
struct syncenv *env = NULL;
|
||||
|
||||
env = task->env;
|
||||
|
||||
pthread_mutex_lock (&env->mutex);
|
||||
{
|
||||
task->woken = 0;
|
||||
}
|
||||
pthread_mutex_unlock (&env->mutex);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
synctask_wake (struct synctask *task)
|
||||
{
|
||||
@ -533,7 +518,6 @@ __synclock_lock (struct synclock *lock)
|
||||
/* called within a synctask */
|
||||
list_add_tail (&task->waitq, &lock->waitq);
|
||||
pthread_mutex_unlock (&lock->guard);
|
||||
synctask_yawn (task);
|
||||
synctask_yield (task);
|
||||
/* task is removed from waitq in unlock,
|
||||
* under lock->guard.*/
|
||||
@ -689,7 +673,6 @@ __syncbarrier_wait (struct syncbarrier *barrier, int waitfor)
|
||||
/* called within a synctask */
|
||||
list_add_tail (&task->waitq, &barrier->waitq);
|
||||
pthread_mutex_unlock (&barrier->guard);
|
||||
synctask_yawn (task);
|
||||
synctask_yield (task);
|
||||
pthread_mutex_lock (&barrier->guard);
|
||||
} else {
|
||||
|
@ -148,14 +148,12 @@ struct syncargs {
|
||||
|
||||
|
||||
#define __yawn(args) do { \
|
||||
args->task = synctask_get (); \
|
||||
if (args->task) { \
|
||||
synctask_yawn (args->task); \
|
||||
} else { \
|
||||
pthread_mutex_init (&args->mutex, NULL); \
|
||||
pthread_cond_init (&args->cond, NULL); \
|
||||
args->done = 0; \
|
||||
} \
|
||||
args->task = synctask_get (); \
|
||||
if (args->task) \
|
||||
break; \
|
||||
pthread_mutex_init (&args->mutex, NULL); \
|
||||
pthread_cond_init (&args->cond, NULL); \
|
||||
args->done = 0; \
|
||||
} while (0)
|
||||
|
||||
|
||||
@ -228,7 +226,6 @@ void syncenv_scale (struct syncenv *env);
|
||||
int synctask_new (struct syncenv *, synctask_fn_t, synctask_cbk_t, call_frame_t* frame, void *);
|
||||
void synctask_wake (struct synctask *task);
|
||||
void synctask_yield (struct synctask *task);
|
||||
void synctask_yawn (struct synctask *task);
|
||||
void synctask_waitfor (struct synctask *task, int count);
|
||||
|
||||
#define synctask_barrier_init(args) syncbarrier_init (&args->barrier)
|
||||
|
Loading…
x
Reference in New Issue
Block a user