[fpc-pascal] spin_lock

Marco van de Voort marcov at stack.nl
Tue May 30 08:57:42 CEST 2006


[ Charset ISO-8859-15 unsupported, converting... ]
> Am Dienstag, 30. Mai 2006 01:05 schrieb Alain Michaud:
> > Hi,
> >
> > would someone know how to execute: spin_lock spin_lock_init and
> > spin_unlock
> >
> > I just want to disable the interrupts for 200 miliseconds maximum!
> > This is not too long and hopefuly, my system will not crash...
> 
> Well, 200 ms is about ages for the CPU/Kernel ..
> 
> > Does someone has any experience with this kind of situation.
> 
> This is not that easy: Is it only for UP or maybe also for SMP machines?
> Basically, for x86 the "cli" and "sti" asm instructions do disable/
> enable interrupts, but read about it before you try.
> Currently, I do such stuff only inside a driver (Linux kernel: 
> spin_lock, or win98 vxd: cli/sti) and don't know about any user space 
> function for this.

FreeBSD has (in pthread.h):
int             pthread_spin_init(pthread_spinlock_t *, int);
int             pthread_spin_destroy(pthread_spinlock_t *);
int             pthread_spin_lock(pthread_spinlock_t *);
int             pthread_spin_trylock(pthread_spinlock_t *);
int             pthread_spin_unlock(pthread_spinlock_t *);



More information about the fpc-pascal mailing list