summaryrefslogtreecommitdiff
path: root/lib/util/smb_threads.h
Commit message (Collapse)AuthorAgeFilesLines
* lib: smb_threads: fix access before init bugRalph Boehme2018-07-041-0/+3
| | | | | | | | | | | | | talloc_stackframe_internal() calls SMB_THREAD_GET_TLS(global_ts) which calls smb_get_tls_pthread() in the POSIX pthread wrapper implementation. If SMB_THREAD_SET_TLS() hasn't been called before, global_ts is NULL and smb_get_tls_pthread dereferences it so it crashes. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13505 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* Make the thread functions a bit easier to useDerrell Lipman2009-05-131-2/+0
| | | | | | | | | | | - Create separate macros for lock and unlock so that it's easier to identify which request is being made. - Initialize *ponce in the SMB_THREAD_ONCE macro in the non-thread-safe case, rather than requiring each init function to determine if it's in the non-thread-safe case and manually initialize. Derrell
* Allow a parameter to smb_thread_once's initialization functionDerrell Lipman2009-05-131-1/+3
| | | | | | | | | | | | - 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
* Fix definition of smb_thread_once - must return int not void asJeremy Allison2009-05-111-1/+1
| | | | | it's used in a ? : comparison macro. Jeremy.
* Don't require external use of internal enum smb_thread_lock_typeDerrell Lipman2009-05-101-3/+4
| | | | | | | | | | - Internally, when locking or unlocking a mutex, we'll pass one of the values of enum smb_thread_lock_type. That enum is not available to users providing a thread implementation. Externally, we'll document the integer values which will be passed to their lock_mutex function, but not require them to access our internal header file. Derrell
* Replace external thread "once" with an internal implementationDerrell Lipman2009-05-101-20/+2
| | | | | | | | | | | | | | | | | | | | | Jeremy, please check... - I'm in the process of providing an interface in libsmbclient to the recently-added threading capabilities. In the process, I discovered that different thread implementations have varying types for the variable passed to the thread_impl_once() function. pthreads, for example, uses type pthread_once_t. Since Samba needs to internally declare these variables, it would need to know the exact type required by each thread implementation's function. After considering multiple methods of obtaining an appropriately sized variable, I decided that for the basic "once" functionality required by Samba, it would be much simpler to just implement our own "once" functionality. We don't require cancellation points et all. This commit adds an smb_thread_once() function that is implemented using an internal mutex. The mutex itself uses the implementation's create_mutex function. This eliminates the need for the user to provide a smb_thread_once function pointer and the entire issue of that function's first parameter. Derrell
* Fix a missing prototype warningVolker Lendecke2009-04-281-0/+2
|
* Ensure we have all the definitions needed in both threaded and non-threaded ↵Jeremy Allison2009-04-201-9/+4
| | | | | | versions. Jeremy.
* Attempt to fix build farm on platforms where pthread_once_t is a struct.Jeremy Allison2009-04-201-1/+4
| | | | Jeremy.
* Fix the pthread_once initialization issue. Make talloc_stackframe useJeremy Allison2009-04-201-25/+36
| | | | | this. Jeremy.
* Fix bug #6089 - Winbind samr_OpenDomain not possible with Samba 3.2.6+Jeremy Allison2009-04-151-1/+1
| | | | | | | What a difference a name makes... :-). Just because something is missnamed SAMR_ACCESS_OPEN_DOMAIN, when it should actually be SAMR_ACCESS_LOOKUP_DOMAIN, don't automatically use it for a security check in _samr_OpenDomain(). Jeremy.
* Ensure a tls key is only generated once - wrap create & destroy in a mutex.Jeremy Allison2009-04-141-32/+52
| | | | | | Change the function names to add _once to the tls_create & tls_destroy to make this obvious. Jeremy.
* Add the thread functions to top level lib/util.Jeremy Allison2009-04-081-0/+120
Not yet used, that's the next step. Jeremy.