Hello Przemek

I cannot think of myself so dumb :-((

I wonder why I took a long route whereas the shortest and
neatest was awailable.


Przemyslaw Czerpak-2 wrote:
> 
> HB_FUNC( HB_GTINFO )
> {
>    if( ISPOINTER( 1 ) && ISNUM( 2 ) )
>    {
>       PHB_GT pGT = hb_gt_ItemBase( hb_param( 1, HB_IT_ANY ) );
> 
>       if( pGT )
>       {
>          HB_GT_INFO gtInfo;
>          gtInfo.pNewVal  = hb_param( 3, HB_IT_ANY );
>          gtInfo.pNewVal2 = hb_param( 4, HB_IT_ANY );
>          gtInfo.pResult  = NULL;
> 
>          HB_GTSELF_INFO( pGT, hb_parni( 2 ), &gtInfo );
>          hb_gt_BaseFree( pGT );
> 
>          if( gtInfo.pResult )
>             hb_itemReturnRelease( gtInfo.pResult );
>       }
>    }
>    else
>       hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME,
> HB_ERR_ARGS_BASEPARAMS );
> }
> 

I changed the name to HB_GTINFOEX and kept this code in gtwvg.c.
It gets me what I require. To function it properly as per my needs,
I had to issue instead of 

         HB_GTSELF_INFO( pGT, hb_parni( 2 ), &gtInfo );
         hb_gt_BaseFree( pGT );


         hb_gt_BaseFree( pGT );
         HB_GTSELF_INFO( pGT, hb_parni( 2 ), &gtInfo );

I have to release the lock before I fetch the values otherwise 
current GT remains locked forever. In theory it should not happen but
happens. Possibly how I am trying to use it havethis side effect.

<<<
Don't you see that it breaks GT locking? 
After: 
    hb_gt_BaseFree( pGT ); 
pGT is not locked and other threads can make some operation on it 
when you are still using it in you INFO() method? 
>>>

I understand your viewpoint and investigating more.
Perhaps at the point I call this function I do not need it to be locked
because I am already on another GT which is in the diaplay process.

I will come to this topic later. For now my request is resolved.

Thanks
Regards
Pritpal Bedi

-- 
View this message in context: 
http://www.nabble.com/hb_gtInfoEx%28-pGT%2C-nGtInfo%2C-xValue%2C-xValue2-%29---Feature-Request-tp20414605p20463092.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to