Loading...
Searching...
No Matches
globus_thread_windows.h
/*
* Copyright 1999-2006 University of Chicago
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined GLOBUS_THREAD_WINDOWS_H
#define GLOBUS_THREAD_WINDOWS_H
#include "globus_common_include.h"
#include "globus_module.h"
#include "globus_time.h"
#include "globus_list.h"
#define GLOBUS_NULL_POINTER_PARAMETER -1
#define globus_thread_once_t int
#define GLOBUS_THREAD_ONCE_INIT 0
#define GLOBUS_THREAD_ONCE_CALLED 1
typedef void * (*globus_thread_func_t)(void *user_arg);
typedef void (*globus_thread_key_destructor_func_t)(void *);
typedef struct globus_thread_key_s
{
DWORD TLSIndex;
globus_thread_key_destructor_func_t destructorFunction;
} globus_thread_key_t;
typedef struct globus_i_thread_t
{
unsigned long threadID;
UserFunctionInfo userFunctionInfo;
// list of keys associated with this thread
// that have destructor functions
globus_list_t * dataDestructionKeyList;
} globus_i_thread_t;
typedef unsigned long globus_thread_t;
typedef struct __globus_threadattr_t
{
void * threadAttribute;
} globus_threadattr_t;
typedef struct _globus_mutexattr_t
{
LPSECURITY_ATTRIBUTES securityAttributes;
} globus_mutexattr_t;
typedef HANDLE globus_mutex_t;
typedef struct _globus_condattr_t
{
LPSECURITY_ATTRIBUTES securityAttributes;
} globus_condattr_t;
typedef struct _globus_cond_t
{
HANDLE events[2];
int numberOfWaiters;
} globus_cond_t;
/* typedef DWORD globus_abstime_t; */
#ifdef __cplusplus
extern "C" {
#endif
/* API calls */
extern int globus_thread_create(globus_thread_t *thread,
globus_threadattr_t *attr,
globus_thread_func_t func,
void *user_arg);
extern void globus_thread_exit(void *status);
#define globus_macro_i_am_only_thread() GLOBUS_FALSE
extern int globus_threadattr_init(globus_threadattr_t *attr);
extern int globus_threadattr_destroy(globus_threadattr_t *attr);
extern int globus_thread_key_create(globus_thread_key_t *key,
globus_thread_key_destructor_func_t destructor_func);
extern int globus_thread_key_delete(globus_thread_key_t key);
extern int globus_thread_setspecific(globus_thread_key_t key,
void *value);
extern void * globus_thread_getspecific(globus_thread_key_t key);
extern globus_thread_t globus_thread_self(void);
extern int globus_thread_equal(globus_thread_t t1,
globus_thread_t t2);
extern int globus_thread_once(globus_thread_once_t *once_control,
void (*init_routine)(void));
extern void globus_thread_yield(void);
extern globus_bool_t globus_i_am_only_thread(void);
extern int globus_mutexattr_init(globus_mutexattr_t *attr);
extern int globus_mutexattr_destroy(globus_mutexattr_t *attr);
extern int globus_mutex_init(globus_mutex_t *mutex,
globus_mutexattr_t *attr);
extern int globus_mutex_destroy(globus_mutex_t *mutex);
extern int globus_mutex_lock(globus_mutex_t *mutex);
extern int globus_mutex_trylock(globus_mutex_t *mutex);
extern int globus_mutex_unlock(globus_mutex_t *mutex);
extern int globus_condattr_init (globus_condattr_t *attr);
extern int globus_condattr_destroy (globus_condattr_t *attr);
extern int globus_cond_init(globus_cond_t *cond,
globus_condattr_t *attr);
extern int globus_cond_destroy(globus_cond_t *cond);
extern int globus_cond_wait(globus_cond_t *cond,
globus_mutex_t *mutex);
extern int globus_cond_timedwait(globus_cond_t *cond,
globus_mutex_t *mutex,
globus_abstime_t * abstime);
extern int globus_cond_timedwait_rel( globus_cond_t *cv,
globus_mutex_t *mut,
long milliseconds );
extern int globus_cond_signal(globus_cond_t *cond);
extern int globus_cond_broadcast(globus_cond_t *cond);
extern int globus_thread_cancel(globus_thread_t thread);
/******************************************************************************
Module definition
******************************************************************************/
extern int globus_i_thread_pre_activate();
extern globus_module_descriptor_t globus_i_thread_module;
#define GLOBUS_THREAD_MODULE (&globus_i_thread_module)
#ifdef __cplusplus
}
#endif
#endif /* GLOBUS_THREAD_WINDOWS_H */
globus_common_include.h
Include System Headers.
globus_list.h
Linked List.
globus_module.h
Reference Counting Module Activation and Deactivation.
globus_time.h
Time Types and Macros.
globus_bool_t
int globus_bool_t
Boolean type.
Definition globus_types.h:93
globus_cond_signal
int globus_cond_signal(globus_cond_t *cond)
Signal a condition to a thread.
Definition globus_thread.c:661
globus_condattr_destroy
int globus_condattr_destroy(globus_condattr_t *attr)
Destroy a condition attribute.
Definition globus_thread.c:852
globus_cond_init
int globus_cond_init(globus_cond_t *cond, globus_condattr_t *attr)
Initialize a condition variableThe globus_cond_init() function creates a condition variable that can ...
Definition globus_thread.c:487
globus_condattr_init
int globus_condattr_init(globus_condattr_t *attr)
Initialize a condition variable attribute.
Definition globus_thread.c:814
globus_cond_broadcast
int globus_cond_broadcast(globus_cond_t *cond)
Signal a condition to multiple threads.
Definition globus_thread.c:697
globus_cond_destroy
int globus_cond_destroy(globus_cond_t *cond)
Destroy a condition variable.
Definition globus_thread.c:526
globus_cond_wait
int globus_cond_wait(globus_cond_t *cond, globus_mutex_t *mutex)
Wait for a condition to be signalled.
Definition globus_thread.c:571
globus_cond_timedwait
int globus_cond_timedwait(globus_cond_t *cond, globus_mutex_t *mutex, globus_abstime_t *abstime)
Wait for a condition to be signalled.
Definition globus_thread.c:623
globus_list_t
struct globus_list globus_list_t
List data type.
globus_mutex_lock
int globus_mutex_lock(globus_mutex_t *mutex)
Lock a mutex.
Definition globus_thread.c:347
globus_mutex_init
int globus_mutex_init(globus_mutex_t *mutex, globus_mutexattr_t *attr)
Initialize a mutex.
Definition globus_thread.c:267
globus_mutex_trylock
int globus_mutex_trylock(globus_mutex_t *mutex)
Lock a mutex if it is not locked.
Definition globus_thread.c:431
globus_mutex_unlock
int globus_mutex_unlock(globus_mutex_t *mutex)
Unlock a mutex.
Definition globus_thread.c:388
globus_mutex_destroy
int globus_mutex_destroy(globus_mutex_t *mutex)
Destroy a mutex.
Definition globus_thread.c:305
globus_mutexattr_destroy
int globus_mutexattr_destroy(globus_mutexattr_t *attr)
Destroy a mutex attribute.
Definition globus_thread.c:775
globus_mutexattr_init
int globus_mutexattr_init(globus_mutexattr_t *attr)
Initialize a mutex attribute.
Definition globus_thread.c:737
globus_thread_key_delete
int globus_thread_key_delete(globus_thread_key_t key)
Delete a thread-local storage key.
Definition globus_thread.c:1123
globus_thread_getspecific
void * globus_thread_getspecific(globus_thread_key_t key)
Get a thread-specific data value.
Definition globus_thread.c:1269
globus_thread_setspecific
int globus_thread_setspecific(globus_thread_key_t key, void *value)
Set a thread-specific data value.
Definition globus_thread.c:1331
globus_thread_key_create
int globus_thread_key_create(globus_thread_key_t *key, globus_thread_key_destructor_func_t destructor_func)
Create a key for thread-specific storage.
Definition globus_thread.c:1081
globus_thread_once
int globus_thread_once(globus_thread_once_t *once_control, void(*init_routine)(void))
Execute a function one time.
Definition globus_thread.c:1206
globus_thread_self
globus_thread_t globus_thread_self(void)
Determine the current thread's ID.
Definition globus_thread.c:1513
globus_thread_equal
int globus_thread_equal(globus_thread_t t1, globus_thread_t t2)
Check whether thread identifiers match.
Definition globus_thread.c:1552
globus_thread_cancel
int globus_thread_cancel(globus_thread_t thread)
Cancel a thread.
Definition globus_thread.c:1709
globus_thread_yield
void globus_thread_yield(void)
Yield execution to another thread.
Definition globus_thread.c:1362
globus_i_am_only_thread
globus_bool_t globus_i_am_only_thread(void)
Determine if threads are supported.
Definition globus_thread.c:1614
globus_thread_create
int globus_thread_create(globus_thread_t *thread, globus_threadattr_t *attr, globus_thread_func_t func, void *user_arg)
Create a new thread.
Definition globus_thread.c:998
globus_thread_exit
void globus_thread_exit(void *status)
Terminate the current thread.
Definition globus_thread.c:1386
globus_thread_key_destructor_func_t
void(* globus_thread_key_destructor_func_t)(void *value)
Thread-specific data destructor.
Definition globus_thread.h:195
globus_cond_t
Condition variable.
Definition globus_thread.h:125
globus_condattr_t
Condition variable attribute.
Definition globus_thread.h:172
globus_mutex_t
Mutex.
Definition globus_thread.h:108
globus_mutexattr_t
Mutex attribute.
Definition globus_thread.h:152
globus_thread_key_t
Thread-specific data key.
Definition globus_thread.h:202
globus_thread_t
Thread ID.
Definition globus_thread.h:72
globus_threadattr_t
Thread attributes.
Definition globus_thread.h:89