3794b1c14f
the QLp structure used to occupy 24 bytes on amd64. with some rearranging the fields we can get it to 16 bytes, saving 8K in the data section for the 1024 preallocated structs in the ql arena. the rest of the changes are of cosmetic nature: - getqlp() zeros the next pointer, so there is no need to set it when queueing the entry. - always explicitely compare pointers to nil. - delete unused code from ape's qlock.c
41 lines
507 B
C
41 lines
507 B
C
#ifndef _PLAN9_SOURCE
|
|
This header file is an extension to ANSI/POSIX
|
|
#endif
|
|
|
|
#ifndef __QLOCK_H_
|
|
#define __QLOCK_H_
|
|
#pragma lib "/$M/lib/ape/lib9.a"
|
|
|
|
#include <u.h>
|
|
#include <lock.h>
|
|
|
|
typedef struct QLp QLp;
|
|
struct QLp
|
|
{
|
|
int inuse;
|
|
int state;
|
|
QLp *next;
|
|
};
|
|
|
|
typedef
|
|
struct QLock
|
|
{
|
|
Lock lock;
|
|
int locked;
|
|
QLp *head;
|
|
QLp *tail;
|
|
} QLock;
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
extern void qlock(QLock*);
|
|
extern void qunlock(QLock*);
|
|
extern int canqlock(QLock*);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|