/* TODO: check this
*/
int lmgr_cond_wait(pthread_cond_t *cond,
- pthread_mutex_t *mutex)
+ pthread_mutex_t *mutex,
+ const char *file, int line)
{
int ret;
lmgr_thread_t *self = lmgr_get_thread_info();
- self->do_V(mutex);
+ self->do_V(mutex, file, line);
ret = pthread_cond_wait(cond, mutex);
- self->pre_P(mutex);
+ self->pre_P(mutex, file, line);
self->post_P();
return ret;
}
* pthread_mutex_lock(m);
* lmgr_post_lock(m);
*/
-void lmgr_pre_lock(void *m)
+void lmgr_pre_lock(void *m, const char *file, int line)
{
lmgr_thread_t *self = lmgr_get_thread_info();
- self->pre_P(m);
+ self->pre_P(m, file, line);
}
/*
/*
* Do directly pre_P and post_P (used by trylock)
*/
-void lmgr_do_lock(void *m)
+void lmgr_do_lock(void *m, const char *file, int line)
{
lmgr_thread_t *self = lmgr_get_thread_info();
- self->pre_P(m);
+ self->pre_P(m, file, line);
self->post_P();
}
/* Not yet working */
int lmgr_cond_wait(pthread_cond_t *cond,
- pthread_mutex_t *mutex);
+ pthread_mutex_t *mutex,
+ const char *file="*unknown*", int line=0);
/* Replacement of pthread_mutex_lock() */
int lmgr_mutex_lock(pthread_mutex_t *m,
/*
* Use them when you want use your lock yourself (ie rwlock)
*/
-void lmgr_pre_lock(void *m); /* Call before requesting the lock */
-void lmgr_post_lock(); /* Call after getting it */
-void lmgr_do_lock(void *m); /* Same as pre+post lock */
-void lmgr_do_unlock(void *m); /* Call just before releasing the lock */
+
+/* Call before requesting the lock */
+void lmgr_pre_lock(void *m, const char *file="*unknown*", int line=0);
+
+/* Call after getting it */
+void lmgr_post_lock();
+
+/* Same as pre+post lock */
+void lmgr_do_lock(void *m, const char *file="*unknown*", int line=0);
+
+/* Call just before releasing the lock */
+void lmgr_do_unlock(void *m);
/*
* Each thread have to call this function to put a lmgr_thread_t object
# define V(x) lmgr_mutex_unlock(&(x), __FILE__, __LINE__)
# define pthread_mutex_lock(x) lmgr_mutex_lock(x, __FILE__, __LINE__)
# define pthread_mutex_unlock(x) lmgr_mutex_unlock(x, __FILE__, __LINE__)
-# define pthread_cond_wait(x,y) lmgr_cond_wait(x,y)
+# define pthread_cond_wait(x,y) lmgr_cond_wait(x,y, __FILE__, __LINE__)
# define pthread_create(a, b, c, d) lmgr_thread_create(a,b,c,d)
#endif
pthread_mutex_unlock(&rwl->mutex);
return 0;
}
- lmgr_pre_lock(rwl);
+ lmgr_pre_lock(rwl, __FILE__, __LINE__);
if (rwl->w_active || rwl->r_active > 0) {
rwl->w_wait++; /* indicate that we are waiting */
pthread_cleanup_push(rwl_write_release, (void *)rwl);
} else {
rwl->w_active = 1; /* we are running */
rwl->writer_id = pthread_self(); /* save writer thread's id */
- lmgr_do_lock(rwl);
+ lmgr_do_lock(rwl, __FILE__, __LINE__);
}
stat2 = pthread_mutex_unlock(&rwl->mutex);
return (stat == 0 ? stat2 : stat);
General:
13Aug09
+ebl update lock manager to display file:line all the time
kes Make SD lock tracing work again. Has not worked for some time.
ebl bat: Add a re-run button on job info page, that allows to
run the selected job with the same properties (level, pool,