示例#1
0
int
__gthread_once (__gthread_once_t *guard, void (*func)(void))
{
  if (guard->done)
    return 0;

#ifdef __RTP__
  __gthread_lock_library ();
#else
  while (!vxTas ((void *)&guard->busy))
    taskDelay (1);
#endif

  /* Only one thread at a time gets here.  Check ->done again, then
     go ahead and call func() if no one has done it yet.  */
  if (!guard->done)
    {
      func ();
      guard->done = 1;
    }

#ifdef __RTP__
  __gthread_unlock_library ();
#else
  guard->busy = 0;
#endif
  return 0;
}
示例#2
0
文件: sysMipsLib.c 项目: ariavie/bcm
BOOL sysBusTas
(
    char *adrs	/* address to be tested-and-set */
)
{
    return (vxTas(adrs));
}