rpm
5.4.15
|
#include "system.h"
#include <rpmiotypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "yarn.h"
#include "debug.h"
Go to the source code of this file.
Data Structures | |
struct | yarnLock_s |
struct | yarnThread_s |
struct | capsule |
Macros | |
#define | pthread_t int |
#define | pthread_self() 0 |
#define | pthread_equal(_t1, _t2) ((_t1) == (_t2)) |
#define | pthread_create(__newthread, __attr, __start_routine, arg) (EINVAL) |
#define | pthread_join(__thread, __value_ptr) (EINVAL) |
#define | pthread_cancel(__th) (EINVAL) |
#define | pthread_cleanup_pop(__execute) |
#define | pthread_cleanup_push(__routine, __arg) |
#define | pthread_attr_t int |
#define | pthread_attr_init(__attr) (EINVAL) |
#define | pthread_attr_destroy(__attr) (EINVAL) |
#define | pthread_attr_setdetachstate(__attr, __detachstate) (EINVAL) |
#define | pthread_mutex_t int |
#define | PTHREAD_MUTEX_INITIALIZER 0 |
#define | PTHREAD_CREATE_JOINABLE 0 |
#define | pthread_mutex_destroy(__mutex) (0) /* FreeLock */ |
#define | pthread_mutex_init(__mutex, __attr) (0) /* NewLock */ |
#define | pthread_mutex_lock(__mutex) (0) /* Possess */ |
#define | pthread_mutex_unlock(__mutex) (0) /* Twist/Release */ |
#define | pthread_cond_t int |
#define | PTHREAD_COND_INITIALIZER 0 |
#define | pthread_cond_destroy(__cond) (0) /* FreeLock */ |
#define | pthread_cond_init(__cond, __attr) (0) /* NewLock */ |
#define | pthread_cond_wait(__cond, __mutex) (EINVAL)/* WaitFor */ |
#define | pthread_cond_broadcast(__cond) (0) /* Twist */ |
#define | fail(_err) _fail((_err), __FILE__, __LINE__) |
#define | until(a) while(!(a)) |
Typedefs | |
typedef void *(* | malloc_t )(size_t) |
typedef void(* | free_t )(void *) |
Functions | |
static void | _fail (int err, const char *fn, unsigned ln) |
void | yarnMem (malloc_t lease, free_t vacate) |
static void * | my_malloc (size_t size) |
yarnLock | yarnNewLock (long initial) |
void | yarnPossess (yarnLock bolt) |
void | yarnRelease (yarnLock bolt) |
void | yarnTwist (yarnLock bolt, yarnTwistOP op, long val) |
void | yarnWaitFor (yarnLock bolt, yarnWaitOP op, long val) |
long | yarnPeekLock (yarnLock bolt) |
yarnLock | yarnFreeLock (yarnLock bolt) |
yarnThread | yarnLaunchStack (void(*probe)(void *), void *payload, void *stack, size_t nstack) |
yarnThread | yarnLaunch (void(*probe)(void *), void *payload) |
yarnThread | yarnJoin (yarnThread ally) |
int | yarnJoinAll (void) |
void | yarnDestruct (yarnThread off_course) |
Variables | |
const char * | yarnPrefix = "yarn" |
void(* | yarnAbort )(int) = NULL |
static malloc_t | my_malloc_f = malloc |
static free_t | my_free = free |
static struct yarnLock_s | threads_lock |
static yarnThread | threads = NULL |
#define fail | ( | _err | ) | _fail((_err), __FILE__, __LINE__) |
Definition at line 199 of file yarn.c.
Referenced by checkPackages(), my_malloc(), rpmbcErrChk(), rpmfts_new(), yarnDestruct(), yarnFreeLock(), yarnJoin(), yarnJoinAll(), yarnLaunchStack(), yarnNewLock(), yarnPossess(), yarnRelease(), yarnTwist(), and yarnWaitFor().
#define pthread_attr_destroy | ( | __attr | ) | (EINVAL) |
Definition at line 65 of file yarn.c.
Referenced by yarnLaunchStack().
#define pthread_attr_init | ( | __attr | ) | (EINVAL) |
Definition at line 64 of file yarn.c.
Referenced by yarnLaunchStack().
#define pthread_attr_setdetachstate | ( | __attr, | |
__detachstate | |||
) | (EINVAL) |
Definition at line 66 of file yarn.c.
Referenced by yarnLaunchStack().
#define pthread_attr_t int |
Definition at line 63 of file yarn.c.
Referenced by yarnLaunchStack().
#define pthread_cancel | ( | __th | ) | (EINVAL) |
Definition at line 59 of file yarn.c.
Referenced by yarnDestruct().
#define pthread_cond_broadcast | ( | __cond | ) | (0) /* Twist */ |
Definition at line 81 of file yarn.c.
Referenced by yarnTwist().
#define pthread_cond_destroy | ( | __cond | ) | (0) /* FreeLock */ |
Definition at line 78 of file yarn.c.
Referenced by yarnFreeLock().
#define pthread_cond_init | ( | __cond, | |
__attr | |||
) | (0) /* NewLock */ |
Definition at line 79 of file yarn.c.
Referenced by yarnNewLock().
#define pthread_cond_wait | ( | __cond, | |
__mutex | |||
) | (EINVAL)/* WaitFor */ |
Definition at line 80 of file yarn.c.
Referenced by yarnWaitFor().
#define pthread_create | ( | __newthread, | |
__attr, | |||
__start_routine, | |||
arg | |||
) | (EINVAL) |
Definition at line 57 of file yarn.c.
Referenced by rpmsqThread(), and yarnLaunchStack().
#define PTHREAD_CREATE_JOINABLE 0 |
Definition at line 70 of file yarn.c.
Referenced by yarnLaunchStack().
#define pthread_equal | ( | _t1, | |
_t2 | |||
) | ((_t1) == (_t2)) |
Definition at line 56 of file yarn.c.
Referenced by rpmsqThreadEqual().
#define pthread_join | ( | __thread, | |
__value_ptr | |||
) | (EINVAL) |
Definition at line 58 of file yarn.c.
Referenced by rpmsqJoin(), yarnJoin(), and yarnJoinAll().
#define pthread_mutex_destroy | ( | __mutex | ) | (0) /* FreeLock */ |
Definition at line 71 of file yarn.c.
Referenced by avClosedir(), and yarnFreeLock().
#define pthread_mutex_init | ( | __mutex, | |
__attr | |||
) | (0) /* NewLock */ |
Definition at line 72 of file yarn.c.
Referenced by avOpendir(), and yarnNewLock().
#define PTHREAD_MUTEX_INITIALIZER 0 |
Definition at line 69 of file yarn.c.
Referenced by open_dso().
#define pthread_mutex_lock | ( | __mutex | ) | (0) /* Possess */ |
Definition at line 73 of file yarn.c.
Referenced by open_dso(), and yarnPossess().
#define pthread_mutex_t int |
Definition at line 68 of file yarn.c.
Referenced by open_dso().
#define pthread_mutex_unlock | ( | __mutex | ) | (0) /* Twist/Release */ |
Definition at line 74 of file yarn.c.
Referenced by open_dso(), yarnRelease(), and yarnTwist().
#define pthread_self | ( | ) | 0 |
Definition at line 55 of file yarn.c.
Referenced by rpmsqThreadEqual().
#define pthread_t int |
Definition at line 54 of file yarn.c.
Referenced by rpmsqJoin(), rpmsqThread(), and rpmsqThreadEqual().
#define until | ( | a | ) | while(!(a)) |
Definition at line 292 of file yarn.c.
Referenced by yarnWaitFor().
|
static |
|
static |
Definition at line 229 of file yarn.c.
References fail, and my_malloc_f.
Referenced by yarnLaunchStack(), and yarnNewLock().
void yarnDestruct | ( | yarnThread | off_course | ) |
Definition at line 571 of file yarn.c.
References fail, yarnThread_s::id, pthread_cancel, and yarnJoin().
Definition at line 330 of file yarn.c.
References yarnLock_s::cond, fail, yarnLock_s::mutex, my_free, pthread_cond_destroy, and pthread_mutex_destroy.
Referenced by rpmioFreePool(), rpmioPutPool(), rpmvfFree(), and rpmzLogFree().
yarnThread yarnJoin | ( | yarnThread | ally | ) |
Definition at line 488 of file yarn.c.
References yarnThread_s::done, fail, yarnThread_s::id, my_free, yarnThread_s::next, pthread_join, threads, yarnLock_s::value, yarnPossess(), and yarnRelease().
Referenced by yarnDestruct().
int yarnJoinAll | ( | void | ) |
Definition at line 524 of file yarn.c.
References yarnThread_s::done, fail, yarnThread_s::id, my_free, yarnThread_s::next, NOT_TO_BE, pthread_join, threads, yarnLock_s::value, yarnPossess(), yarnRelease(), and yarnWaitFor().
yarnThread yarnLaunch | ( | void(*)(void *) | probe, |
void * | payload | ||
) |
Definition at line 481 of file yarn.c.
References capsule::probe, and yarnLaunchStack().
yarnThread yarnLaunchStack | ( | void(*)(void *) | probe, |
void * | payload, | ||
void * | stack, | ||
size_t | nstack | ||
) |
Definition at line 436 of file yarn.c.
References yarnThread_s::done, fail, yarnThread_s::id, my_malloc(), yarnThread_s::next, capsule::payload, capsule::probe, pthread_attr_destroy, pthread_attr_init, pthread_attr_setdetachstate, pthread_attr_t, pthread_create, PTHREAD_CREATE_JOINABLE, threads, yarnPossess(), and yarnRelease().
Referenced by yarnLaunch().
yarnLock yarnNewLock | ( | long | initial | ) |
Definition at line 248 of file yarn.c.
References yarnLock_s::cond, fail, yarnLock_s::mutex, my_malloc(), pthread_cond_init, pthread_mutex_init, and yarnLock_s::value.
Referenced by open_dso(), rpmioGetPool(), rpmioNewPool(), rpmvfNew(), and rpmzLogNew().
long yarnPeekLock | ( | yarnLock | bolt | ) |
Definition at line 325 of file yarn.c.
References yarnLock_s::value.
Referenced by httpOpen(), rpmdbClose(), rpmioFreePoolItem(), rpmioLinkPoolItem(), rpmioUnlinkPoolItem(), rpmvfFree(), rpmzLogFree(), rpmzLogLink(), and urlFreeCache().
void yarnPossess | ( | yarnLock | bolt | ) |
Definition at line 262 of file yarn.c.
References fail, yarnLock_s::mutex, and pthread_mutex_lock.
Referenced by headerLoad(), httpOpen(), open_dso(), pgpDigFini(), rpmdbClose(), rpmioFreePool(), rpmioFreePoolItem(), rpmioGetPool(), rpmioLinkPoolItem(), rpmioPutPool(), rpmioUnlinkPoolItem(), rpmtsFini(), rpmvfFree(), rpmzLogAdd(), rpmzLogFree(), rpmzLogLink(), rpmzMsgShow(), urlFreeCache(), yarnJoin(), yarnJoinAll(), and yarnLaunchStack().
void yarnRelease | ( | yarnLock | bolt | ) |
Definition at line 270 of file yarn.c.
References fail, yarnLock_s::mutex, and pthread_mutex_unlock.
Referenced by httpOpen(), open_dso(), pgpDigFini(), rpmioFreePool(), rpmioGetPool(), rpmtsFini(), rpmzLogAdd(), rpmzMsgShow(), urlFreeCache(), yarnJoin(), yarnJoinAll(), and yarnLaunchStack().
void yarnTwist | ( | yarnLock | bolt, |
yarnTwistOP | op, | ||
long | val | ||
) |
Definition at line 279 of file yarn.c.
References BY, yarnLock_s::cond, fail, yarnLock_s::mutex, pthread_cond_broadcast, pthread_mutex_unlock, TO, and yarnLock_s::value.
Referenced by rpmdbClose(), rpmioFreePoolItem(), rpmioGetPool(), rpmioLinkPoolItem(), rpmioPutPool(), rpmioUnlinkPoolItem(), rpmvfFree(), rpmzLogFree(), and rpmzLogLink().
void yarnWaitFor | ( | yarnLock | bolt, |
yarnWaitOP | op, | ||
long | val | ||
) |
Definition at line 295 of file yarn.c.
References yarnLock_s::cond, fail, yarnLock_s::mutex, NOT_TO_BE, pthread_cond_wait, TO_BE, TO_BE_LESS_THAN, TO_BE_MORE_THAN, until, and yarnLock_s::value.
Referenced by rpmioGetPool(), and yarnJoinAll().
|
static |
Definition at line 214 of file yarn.c.
Referenced by yarnFreeLock(), yarnJoin(), and yarnJoinAll().
|
static |
Definition at line 213 of file yarn.c.
Referenced by my_malloc().
|
static |
Definition at line 358 of file yarn.c.
Referenced by yarnJoin(), yarnJoinAll(), and yarnLaunchStack().
|
static |