[fpc-pascal] spin_lock
Jonas Maebe
jonas.maebe at elis.ugent.be
Tue May 30 09:51:20 CEST 2006
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.
Jonas
More information about the fpc-pascal
mailing list