1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-04 08:22:08 +03:00

Allow a parameter to smb_thread_once's initialization function

- This should make life easier for ourselves. We're no longer constrained to
  the semantics of pthread_once, so let's allow passing a parameter to the
  initialization function. Some of Samba's init functions return a
  value. Although I haven't searched, I suspect that some of the init
  functions require in input parameters. The parameter added here can be used
  for input, output, or both, as necessary... or ignored, as is now done in
  talloc_stackframe_init().

Derrell
This commit is contained in:
Derrell Lipman
2009-05-13 09:49:59 -04:00
parent 652251701d
commit e03b9ae609
4 changed files with 28 additions and 15 deletions

View File

@ -33,12 +33,12 @@
#define SMB_THREAD_LOCK(plock, type) \
(global_tfp ? global_tfp->lock_mutex((plock), (type), __location__) : 0)
#define SMB_THREAD_ONCE(ponce, init_fn) \
(global_tfp \
? (! *(ponce) \
? smb_thread_once((ponce), (init_fn)) \
: 0) \
: ((init_fn()), 0))
#define SMB_THREAD_ONCE(ponce, init_fn, pdata) \
(global_tfp \
? (! *(ponce) \
? smb_thread_once((ponce), (init_fn), (pdata)) \
: 0) \
: ((init_fn(pdata)), 0))
#define SMB_THREAD_CREATE_TLS(keyname, key) \
(global_tfp ? global_tfp->create_tls((keyname), &(key), __location__) : 0)