[fpc-pascal] spin_lock
Burkhard Carstens
fpc at bcsoft.de
Tue May 30 09:59:21 CEST 2006
Am Dienstag, 30. Mai 2006 09:51 schrieb Jonas Maebe:
> On 30 mei 2006, at 08:57, Marco van de Voort wrote:
> >> 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 *);
>
> Those (fortunately) do not disable interrupts. I can't imagine that
> any (generic) pre-emptively multitasked OS would allow a user space
> program to disable interrupts.
exactly what I thought ..
Burkhard
More information about the fpc-pascal
mailing list