Ignore:
Timestamp:
Nov 26, 2006, 1:36:45 PM (19 years ago)
Author:
cinc
Message:

Implemented wpRequestObjectMutex() and wpReleaseObjectMutex(). These are implemented using the OS/2 api.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/desktop/class_c/wpobject.c

    r110 r113  
    3939 */
    4040#define INCL_DOS
     41#define INCL_DOSERRORS
     42#define INCL_DOSSEMAPHORES
    4143#include <os2.h>
    4244
     
    4547
    4648#include <string.h>
     49#include "desktoptypes.h"
    4750#include "wpobject.ih"
    4851
    49 #include "desktoptypes.h"
    5052
    5153NOM_Scope gpointer NOMLINK impl_WPObject_wpAllocMem(WPObject* nomSelf, const CORBA_unsigned_long cbBytes,
     
    9698NOM_Scope void NOMLINK impl_WPObject_nomInit(WPObject* nomSelf, CORBA_Environment *ev)
    9799{
    98 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */
     100  WPObjectData* nomThis=WPObjectGetData(nomSelf);
    99101
    100102  /* orbit-idl-c-stubs.c, VoyagerWriteProtoForParentCall line 84 */
     
    104106            __FUNCTION__, nomSelf , nomSelf->mtab->nomClassName);
    105107
     108  /* Initialize important data before letting subclasses do their stuff */
     109  //_gObjectMutex=g_mutex_new();
     110  if(NO_ERROR!=DosCreateMutexSem(NULL, &_gObjectMutex, 0, FALSE))
     111    {
     112      g_error("Can't create a mutex for WPObject!");
     113    }
     114
    106115  _wpInitData(nomSelf, ev);
    107116}
     
    109118NOM_Scope void NOMLINK impl_WPObject_nomUninit(WPObject* nomSelf, CORBA_Environment *ev)
    110119{
    111 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */
     120  WPObjectData* nomThis=WPObjectGetData(nomSelf);
    112121
    113122  _wpUnInitData(nomSelf, ev);
    114123
     124  //g_mutex_free(_gObjectMutex);
     125  DosCloseMutexSem(_gObjectMutex);
    115126  WPObject_nomUninit_parent(nomSelf,  ev);
    116127}
     
    170181  return NULLHANDLE;
    171182}
     183
     184NOM_Scope CORBA_unsigned_long NOMLINK impl_WPObject_wpRequestObjectMutexSem(WPObject* nomSelf,
     185                                                                            const CORBA_unsigned_long ulReserved, CORBA_Environment *ev)
     186{
     187  WPObjectData* nomThis=WPObjectGetData(nomSelf);
     188
     189  return DosRequestMutexSem(_gObjectMutex, -1L);
     190}
     191
     192NOM_Scope CORBA_unsigned_long NOMLINK impl_WPObject_wpReleaseObjectMutexSem(WPObject* nomSelf, CORBA_Environment *ev)
     193{
     194  WPObjectData* nomThis=WPObjectGetData(nomSelf);
     195  return DosReleaseMutexSem(_gObjectMutex);
     196}
Note: See TracChangeset for help on using the changeset viewer.