This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Atomic operations


Hi All!
My target is pc386. There is a question.
I want to make an atomic a little code sequence in a thread.
For example:
static int resource;

if ( resource <0) {
  return -1;
}
resource --;

The resource variable can vary in other threads and in in interrupt
handlers.

I can use  cyg_sheduler_(un)lock() or a mutex  etc.
But I think that these solutions are expensive for little code sequences.

Is there in eCos a something similar to simple CPU masking?

Thanks in advance.

--
Boris Guzhov,
St.Petersburg, Russia




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]