lock
Jeff Johnston
jjohnstn@redhat.com
Tue Jul 4 23:59:00 GMT 2006
Rosière mathieu wrote:
> Hi,
>
> I have a system with multi cpu. All thread running on each cpu, and
> write a message on a tty. But the primitive of lock (in <sys/lock.h>) is
> not implemented. (in configure.host, i have set the flag
> newlib_multithread)
>
> * Have an implementation of this primitive?
You will have to provide your own. There is code for the x86-linux lock
in the libc/sys/linux/machine/i386 directory. Are we talking about an
existing newlib platform or something new?
> * Are they hardware's dependant? (by exemple to use a primitive test and
> set)
>
Yes, it is hardware dependent. If you have an atomic test and set insn
or something similar, it is reasonably straightforward. If there is no
hardware support you will have to resort to some form of spin-lock.
-- Jeff J.
More information about the Newlib
mailing list