コード例 #1
0
ファイル: os2thred.c プロジェクト: dimitrianoudi/Jaxer
void
_PR_MD_RESUME_THREAD(PRThread *thread)
{
    if (_PR_IS_NATIVE_THREAD(thread)) {
        DosResumeThread(thread->md.handle);
    }
}
コード例 #2
0
/*--------------------------------------------------
 * Resume the thread
 *-------------------------------------------------*/
PMThread& PMThread::resume()
{
  if( run_id != -1 )
  {
    APIRET rc = DosResumeThread( run_id );

    if( rc != NO_ERROR && rc != ERROR_NOT_FROZEN )
      PM_THROW_OS2ERROR(rc);
  }
  return *this;
}
コード例 #3
0
/****************************************************************\
 * Routine to start semaphore example                           *
 *--------------------------------------------------------------*
 *                                                              *
 *  Name:     StartSemExample(VOID)                             *
 *                                                              *
 *  Purpose:  Calls routines to create semaphores and draw      *
 *            resources.  Creates consumer threads.             *
 *                                                              *
 *  Usage:    Called in file usercmd.c when the user selects    *
 *            start from the semaphore menu.                    *
 *                                                              *
 *  Method:   Uses routines in paint.c to draw consumers and    *
 *            resources.  This is done by creating a paint      *
 *            message, not calling the draw routines directly.  *
 *                                                              *
 *  Returns:  TRUE if start succeeds, FALSE if start fails      *
 *                                                              *
\****************************************************************/
INT   StartSemExample(VOID)
{
    TID         tid=0;
    ULONG       rc;
    INT         i;
    FONTMETRICS fntmet;
    HPS         hps;
    SWP         swp;

    InitSemaphExample();

    rc = CreateAllSems();

    if (rc)
        return FALSE;
    /****************************************************************\
     * Create consumer threads. Note that values can be passed to   *
     * threads in OS/2 2.0. We pass the ordinal number of the child *
     * to each child.                                               *
    \****************************************************************/

    for (usConsumerThreadsCreated = 0;
     usConsumerThreadsCreated < cNumUsers; usConsumerThreadsCreated++)
    {
        rc = DosCreateThread((PTID) &tid, (PFNTHREAD)ThreadConsumer,
             (ULONG) usConsumerThreadsCreated, (ULONG)1,(ULONG) STACKSIZE);
        if (rc)
        {
            SemError("DosCreateThread",rc);
            return FALSE;
        }
        else
        {
            thrConsumers[usConsumerThreadsCreated].tid = tid;
            thrConsumers[usConsumerThreadsCreated].lHits = 0L;
        }
    }
    for (i = 0; i < (INT) cNumUsers; i++)
    {
        DosResumeThread (thrConsumers[i].tid);
    }
    hps = WinGetPS (hwndMain);
    if (hps)
    {
        GpiQueryFontMetrics (hps, (LONG) sizeof fntmet, &fntmet);
        WinQueryWindowPos (hwndMain, &swp);
        SetRectPositions((SHORT)swp.cx, (SHORT)swp.cy,
                         (SHORT) fntmet.lMaxBaselineExt,
                         (SHORT) fntmet.lMaxDescender);
        DrawRects (hps);
        WinReleasePS (hps);
    }
    return TRUE;
}
コード例 #4
0
ファイル: Sammy.c プロジェクト: OS2World/UTIL-WPS-WPSam
BOOL ChangeWPS(PCHAR pszUserIni, PCHAR pszSystemIni)
   {
   PCHAR        pcEnv;
   PRFPROFILE   prfProfile;
   BOOL         bSuccess;

   if (*pszSystemIni == '\0')
      prfProfile.pszSysName = pShareInitOS2->pszRootSystemIni;
   else
      prfProfile.pszSysName = pszSystemIni;

   if (*prfProfile.pszSysName == '\0')
      prfProfile.pszSysName = (DosScanEnv (ENV_SYSTEM_INI, &pcEnv) ? "" : pcEnv);

   if (*pszUserIni == '\0')
      {
      prfProfile.pszUserName = pShareInitOS2->pszRootUserIni;
      pShareInitOS2->ulFlag  = pShareInitOS2->ulFlag_Root; // ulFlag f�r Rootdesktop
      }
   else
      prfProfile.pszUserName = pszUserIni;

   if (*prfProfile.pszUserName == '\0')
      prfProfile.pszUserName = (DosScanEnv (ENV_USER_INI, &pcEnv) ? "" : pcEnv);

   prfProfile.cchUserName = strlen(prfProfile.pszUserName);
   prfProfile.cchSysName  = strlen(prfProfile.pszSysName);

   if (ulOldFlag & CLOSEAPPL)
      WinSetObjectData(WinQueryObject("<WP_DESKTOP>"), "WORKAREA=YES");
   else
      WinSetObjectData(WinQueryObject("<WP_DESKTOP>"), "WORKAREA=NO");

   WinPostMsg(WinQueryWindow(HWND_DESKTOP, QW_BOTTOM), WM_CLOSE, 0, 0);
   DebugS (1, "HWND_DESKTOP closed");

   if( hevPrfResetLock )
      {
      DosWaitEventSem (hevPrfResetLock, SEM_INDEFINITE_WAIT);
      DosSleep(1000);
      DebugS (1, "hevPrfResetLock released");
      }
   else
      DosSleep(20000);

   bSuccess = PrfReset(hab, &prfProfile);
   DebugULd (1, "PrfReset", "return", bSuccess);

/*
 *  Beim Umschalten auf den Root, egal ob von Sammy oder von WPSamF ausgel�st,
 *  wird die Shell vom PrfReset nicht geschlossen.
 *  Solange die Ursache nicht bekannt ist, bleibt nichts anderes �brig,
 *  als an dieser Stelle symptomatisch vorzugehen und die Shell abzuschie�en.
 */
   if (*pszUserIni == '\0')
      {
      DosSuspendThread (tid1);
      DosKillProcess( DKP_PROCESSTREE, ulShellID );   // sog. Budnik'scher Arschtritt
      DebugS (1, "Shell killed");
      DosResumeThread (tid1);
      }

   if( !bSuccess )
      {
      WinSetObjectData(WinQueryObject("<WP_DESKTOP>"), "OPEN=ICON;WORKAREA=YES");
      DebugS (1, "Desktop set to <WP_DESKTOP>");
      intSammyRetCode = 250;
      WinPostQueueMsg (hmq, WM_QUIT, 0L, 0L);
      }
   else
      ulOldFlag = pShareInitOS2->ulFlag;

   return( bSuccess );
   }