Changeset 113 for trunk/desktop


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.

Location:
trunk/desktop
Files:
5 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}
  • trunk/desktop/idl/wpnativetypes.idl

    r108 r113  
    3838native PPRIVFOLDERDATA;
    3939native gint;
     40native PGMutex; /* For the object mutex */
     41native HMUX;    /* This one will be removed when a threaded glib is avail */
     42native PGSList; /* For inuse list */
    4043
    4144#endif /* WPFOLDERTYPES_IDL_INCLUDED */
  • trunk/desktop/idl/wpobject.idl

    r110 r113  
    5656  gpointer wpAllocMem(in unsigned long cbBytes,
    5757                      inout unsigned long prc);
     58  boolean  wpFreeMem(in gpointer pByte);
     59  void     wpInitData();
     60  void     wpUnInitData();
     61  gpointer wpOpen(in gpointer ptrReserved, in unsigned long ulView, in gpointer ptrParams);
     62  void     wpLockObject();
     63  boolean  wpUnlockObject();
     64  boolean  wpObjectIsLocked();
     65  gpointer wpQueryIcon();
     66  unsigned long  wpRequestObjectMutexSem(in unsigned long ulReserved);
     67  unsigned long     wpReleaseObjectMutexSem();
    5868
    59   boolean wpFreeMem(in gpointer pByte);
    60 
    61   void wpInitData();
    62   void wpUnInitData();
    63   gpointer wpOpen(in gpointer ptrReserved, in unsigned long ulView, in gpointer ptrParams);
    64   void wpLockObject();
    65   boolean wpUnlockObject();
    66   boolean wpObjectIsLocked();
    67   gpointer wpQueryIcon();
    68 
     69  /* Methods overriden by this class */
    6970  NOMOVERRIDE(nomInit);
    7071  NOMOVERRIDE(nomUninit);
     72
     73  /* Instancce variables of this class. Theses are not
     74     attributes. */
    7175  NOMINSTANCEVAR(gint iLockCounter);
     76  NOMINSTANCEVAR(HMUX gObjectMutex);
     77  NOMINSTANCEVAR(PGSList glstObjectInUse);
     78
    7279};
    7380
  • trunk/desktop/include/desktoptypes.h

    r107 r113  
    22#define DESKTOPTYPES_H_INCLUDED
    33
    4 
     4/* Inuse lists */
    55typedef struct _USEITEM
    66{
     
    1515} MEMORYITEM, *PMEMORYITEM;
    1616
     17#define USAGE_MEMORY          1
    1718
    18 #define USAGE_MEMORY          1
    19  
     19/* Misc types used with objects */
     20typedef GSList *PGSList;
     21typedef GMutex *PGMutex;
     22
     23/* Errors */
    2024#define NOMERROR_NOT_ENOUGH_MEMORY 8
    2125 
  • trunk/desktop/src/vdesktop.c

    r102 r113  
    6565 g_message("We started...\n");   
    6666
     67#if 0
     68 /* Initialize thread subsystem */
     69 if(!g_thread_supported())
     70   g_thread_init(NULL);
     71#endif
    6772
    6873  /* Create a window with a 'quit' button to terminate us */
Note: See TracChangeset for help on using the changeset viewer.