TIP: Click on subject to list as thread! ANSI
echo: fidosoft.husky
to: andrew clarke
from: Alexander S. Aganichev
date: 2002-11-19 21:43:14
subject: [fwd] Re: locking()

andrew,

Not so long ago (19 Nov 02) you wrote to Stas:
 ac>>> How do you get locking() to work in MingW32?
 >> smapi/compiler.h
 ac> You haven't demonstrated that it works.

Here's the code which is working in GoldED+:

//  ------------------------------------------------------------------

#if defined(__MINGW32__) || defined(_MSC_VER)

int lock(int fh, long offs, long len) {

  if(LockFile((HANDLE)_get_osfhandle(fh), offs, 0L, len, 0L)) return 0;
  else return -1;
}

#endif


//  ------------------------------------------------------------------

#if defined(__MINGW32__) || defined(_MSC_VER)

int unlock(int fh, long offs, long len) {

  if(UnlockFile((HANDLE)_get_osfhandle(fh), offs, 0L, len, 0L)) return 0;
  else return -1;
}

#endif

WBR, Alexander

--- GoldED+ snapshot-2002.10.27 (WinNT 5.1.2600-Service_Pack_1 i686)
* Origin: Fraggle's Nest, Riga, Latvia (2:203/614.103)
SEEN-BY: 10/3 345 102/943 106/1 2 3 1234 2000 123/500 128/187 130/803 140/1
SEEN-BY: 143/2 201/505 226/600 229/1000 2000 3000 249/116 267/200 280/5003
SEEN-BY: 333/0 379/1 1200 633/267 270 2404/201 2624/306 3800/1
@PATH: 203/600 20/11 2411/413 2432/200 2476/418 140/1 106/2000 1 379/1 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.