This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Spin locks
Vardhan, Sundara (GE Infra, Energy) wrote:
> Thanks for the reply. Please find below a code snippet of the function
> that calls the spin lock. Hope this helps
>
> int gstas( unsigned char *ip )
> #else
> int gstas(ip)
> unsigned char *ip;
> #endif
> /*
> PURPOSE: To atomically lock a byte.
>
> DESCRIPTION: This routine is used to atomically lock a lock
> structure which is one byte in size.
>
> */
> {
> unsigned char gstas_orig_byte ;
> int status = RT_SUCCESS ;
>
> gstas_orig_byte=__sync_lock_test_and_set(ip,0xff);
> if ( 0 != gstas_orig_byte )
> {
> status = RT_ERROR ;
> }
> return( status ) ;
> }
>
> The above function is called by different processes when the product is
> in runtime. This function returns error in different processes during
> different run cycles.
>
> Hope this helps.
Not really, sorry. The example test case has to run (i.e. has to have a
main() function) and has to demonstrate the problem by failing. Snippets
don't do it. This would also be the case if you were paying for gcc
support; the burden on you isn't any less because you're getting
community support for no charge.
Andrew.