diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-06-15 13:44:51 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-06-15 13:44:51 +0200 |
commit | 16ecb90c3ac88bb2261c31c990d88f97f1a1b32f (patch) | |
tree | 393807bddcfb330384ab7c2bd5aa32200571d495 /runtime/srUtils.h | |
parent | 1f874c220860d3a19fb6cfb60f0902a08639f6ab (diff) | |
download | rsyslog-16ecb90c3ac88bb2261c31c990d88f97f1a1b32f.tar.gz rsyslog-16ecb90c3ac88bb2261c31c990d88f97f1a1b32f.tar.xz rsyslog-16ecb90c3ac88bb2261c31c990d88f97f1a1b32f.zip |
omfile buffers are now synchronized after inactivity
This is the first shot at this functionality. Currently, we run off a fixed
counter in the rsyslogd mainloop, which needs to be restructured. But this
code works, so it is a good time for a commit.
Diffstat (limited to 'runtime/srUtils.h')
-rw-r--r-- | runtime/srUtils.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/runtime/srUtils.h b/runtime/srUtils.h index 699f8527..b37559cf 100644 --- a/runtime/srUtils.h +++ b/runtime/srUtils.h @@ -125,4 +125,17 @@ rsRetVal getFileSize(uchar *pszName, off_t *pSize); d_pthread_mutex_unlock(mut); \ pthread_setcancelstate(iCancelStateSave, NULL); \ } + +/* The unconditional versions of the macro always lock the mutex. They are preferred in + * complex scenarios, where the simple ones might get mixed up by multiple calls. + */ +#define DEFVARS_mutexProtection_uncond\ + int iCancelStateSave +#define BEGIN_MTX_PROTECTED_OPERATIONS_UNCOND(mut) \ + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &iCancelStateSave); \ + d_pthread_mutex_lock(mut); +#define END_MTX_PROTECTED_OPERATIONS_UNCOND(mut) \ + d_pthread_mutex_unlock(mut); \ + pthread_setcancelstate(iCancelStateSave, NULL); + #endif |