home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 15 Message
/
15-Message.zip
/
oe991016.zip
/
Pr991015.txt
< prev
next >
Wrap
Text File
|
1999-10-16
|
14KB
|
360 lines
OS/2 Programming (Fidonet)
Saturday, 09-Oct-1999 to Friday, 15-Oct-1999
+----------------------------------------------------------------------------+
From: Vitus Jensen 08-Oct-99 00:40:04
To: Will Honea 10-Oct-99 01:50:04
Subj: VAC 3.0 Subsystem Librar
Hello Will,
05.10.99 02:15, Will Honea wrote a message to Vitus Jensen:
VJ>> I'm implementing some DLLs to allow third party applications to
VJ>> control machines via serial lines. The DLLs use CRT routines
VJ>> (malloc,free) and are currently statically linked to their own
VJ>> version of CRTs. I'm wondering whether those statically linked
VJ>> CRTs are the correct way to do it or may even cause errors (in
VJ>> fact there is currently a hang situation reported).
WH> Well, static linking is a good way to use LOTS of memory. Since
WH> you are using several DLL's you could save a lot of space by
WH> dynamic linking. I use it in one big app I work on and the RTL
WH> (re-named per IBM rules) is bigger than any of the 'functional
WH> DLL's.
The DLLs are quite simple and don't use much of the CRT. Filesizes between 50
and 70 KB with static linking. And the machine is really oversized for the
job: 128 MB RAM.
VJ>> Could someone explain the use of the subsystem library (compile
VJ>> switch /Rn) and whether it's use would be better in my case. And
VJ>> please remember that I have a thread hidden inside the DLLs
VJ>> (currently started via _beginthread but /Rn doesn't support it,
VJ>> DosStartThread plus some magic code required?).
WH> I use _beginthread() liberally. Most of my threads deal with
WH> comm links - network and serial - so it only makes sense to spin
WH> them off that way. There are some slicker ways to instantiate
WH> the threads but they all seem to deny me some important tweeking.
WH> A couple of the threads I run will need from 28k to 4 meg for
WH> stack/heap and _beginthread() allows me the flexibility to
WH> allocate enough that the thread can then commit whatever it
WH> really needs. BTW, all these threads are launched from DLL code
WH> and use semaphores and a message queue for control and
WH> process-related communications.
And those DLLs use statically linked full/subsystem CRT? Or a shared CRT as
DLL?
WH> Just be VERY careful of where you put your waits and be extra
WH> meticulous about cleanup on thread exit. The biggest trap the
WH> programmers I work with fall into is misuse of shared memory -
WH> they just can't seem to clean up after themselves. I think it's
WH> a carryover from using multiple processes rather than true
WH> threads. Just to ease your mind a little, one comm job that gets
WH> done has been known to run over 100 threads in an iterative
WH> challenge-reply communications exchange and I've always been able
WH> to kill the process cleanly at any stage.
Actually I think memory allocation/cleanup, waiting (or not waiting) for
threads to die is no complicate task. You have to stop and think sometimes
but, well, you write every line and there is always time to think (or should).
The most complicated in this scenario are the things you don't see.
What happens in _DLL_InitTerm? With full CRT support you don't really need
to code your one but what has been done by the compiler vendor? I can tweak
VAC to call DosWaitEventSem(,-1) during the _CRT_Term called in
_DLL_InitTerm...
Another major point are exceptions. I've learned that I need my own exception
handlers if I use my own CRT (#pragma handler will do). But what has to be
done in threads started by _beginthread? And won't my exception handler
return XCPT_CONTINUE_SEARCH if it doesn't want to handle the exception? This
will end up in the application's exception handler which has no idea about the
code which generated the exception...
With /Rn there is no need for exception handlers (as I understand?).
WH> Also, don't be fooled by the IOC propaganda - the base API's like
WH> _beginthread()\_endthread() are still quite available.
?IOC?
The compiler tells me that /Gm isn't compatible with /Rn and ignores it. For
this reason prototypes of _beginthread/_endthread aren't available. When I
scan cppon30.lib (I think this is the library the compiler links with) then
there the word 'thread' can't be found.
Are you sure that /Rn supports _beginthread?
C-x C-s
Vitus
--- Sqed/rexx 114:
* Origin: Coming Soon!! Mouse Support for Edlin!! (2:2474/424.1)
7102/1
+----------------------------------------------------------------------------+
From: David Calafrancesco 08-Oct-99 22:43:12
To: Mod Rules Poster 10-Oct-99 07:04:07
Subj: OS2PROG Echo Rules
Mod Rules Poster wrote in a message to All:
MRP> Rev: Wed 6 Oct 99 21:34
MRP> ============================================================
MRP> ================ The Official Rules of The FidoNet OS2PROG
MRP> Echo
MRP> The objectives of the OS2PROG echo are:
Could the moderator contact me offline. The email address below will work
well.
Dave Calafrancesco, Team OS/2
dave@drakkar.org
... They got the library at Alexandria, they're not getting mine!
---
* Origin: Druid's Grove BBS - (914)/876-2237 (1:2624/306)
900/525
+----------------------------------------------------------------------------+
From: Vitus Jensen 09-Oct-99 22:40:15
To: Mads Orbesen Troest 13-Oct-99 22:41:22
Subj: VAC 3.0 Subsystem Library
Moin Mads,
05.10.99 15:46, Mads Orbesen Troest wrote a message to Vitus Jensen:
VJ>> Could someone explain the use of the subsystem library (compile
VJ>> switch /Rn) and whether it's use would be better in my case.
MOT> As far as I am informed, the Subsystem switch means that /no/
MOT> startup/termination code is inserted in the generated code. If
MOT> you use any library functions whatsoever, this is probably not a
MOT> very good switch to check.
There *is* startup/termination code inserted. Check your documentation:
_rmem_init/_rmem_term is called.
There is a limited range of library functions available, including malloc and
free.
/*BUT*/ that runtime library has no support for multithreading! So when I
recoded my DLLs to make a test with the subsystem CRT I had to protect the CRT
via a mutex. On the other hand there seems to be no need for a exception
handler. And the result is smaller.
I still don't know which way is best...
C-x C-s
Vitus
--- Sqed/rexx 97:
* Origin: That'll be $67.50 CCCHHHHHIIIIINNNNGGGG!!!! (2:2474/424.1)
+----------------------------------------------------------------------------+
From: Vitus Jensen 09-Oct-99 22:58:18
To: Will Honea 13-Oct-99 22:41:22
Subj: VAC 3.0 Subsystem Librar
Hi Will,
08.10.99 00:40, Vitus Jensen wrote a message to Will Honea:
...
WH>> Just be VERY careful of where you put your waits and be extra
WH>> meticulous about cleanup on thread exit. The biggest trap the
WH>> programmers I work with fall into is misuse of shared memory -
WH>> they just can't seem to clean up after themselves. I think it's
WH>> a carryover from using multiple processes rather than true
WH>> threads. Just to ease your mind a little, one comm job that
WH>> gets done has been known to run over 100 threads in an iterative
WH>> challenge-reply communications exchange and I've always been
WH>> able to kill the process cleanly at any stage.
VJ> Actually I think memory allocation/cleanup, waiting (or not
VJ> waiting) for threads to die is no complicate task. You have to
VJ> stop and think sometimes but, well, you write every line and
VJ> there is always time to think (or should).
...
And if you did something wrong it shows up in a debugger and looks familiar.
I assumed a DosWaitEventSem() on a private semaphore will fail if called
during Exitlist processing. After all there is no other thread which will
ever post that semaphore. But OS/2 thinks different: just ERROR_TIMEOUT after
some time of waiting...
Is there any special flag I should check? Mhmm, that thread I started should
be dead during exitlist processing. What resources are belonging to a
thread... only stack and the TID. But no API DosQueryThread(tid,...). :-(
He, there is DosGetInfoBlocks and the PIB holds a bit saying "the current
process is in exit list processing". I will check this flag.
Bye,
Vitus
--- Sqed/rexx 87:
* Origin: Windows NT? New Technology? I don't think so... (2:2474/424.1)
+----------------------------------------------------------------------------+
From: Vitus Jensen 13-Oct-99 01:47:01
To: Will Honea 14-Oct-99 05:34:02
Subj: VAC 3.0 Subsystem Librar
Hello Will,
09.10.99 22:58, Vitus Jensen wrote a message to Will Honea:
[...DosWaitEventSem in Exitlist...]
VJ> He, there is DosGetInfoBlocks and the PIB holds a bit saying "the
VJ> current process is in exit list processing". I will check this
VJ> flag.
This did the job, no more hangs.
But I'm uncertain whether I'm testing the correct bit. Read the
documentation:
========<start>=======================================
pib_flstatus (ULONG)
Process' status bits.
A value of 1 in this bit flag indicates that the current process is in
exit
list processing.
========<end>=========================================
pib_flstatus is indeed bit coded, I've seen 0x10 during normal processing and
0x17 in the Exitlist.
I'm now testing Bit 0, when this bit is set exitlist processing is assumed and
no waiting will occur. Do I test the correct bit???
C-x C-s
Vitus
--- Sqed/rexx 440:
* Origin: Those who can, do. Those who can't, supervise! (2:2474/424.1)
+----------------------------------------------------------------------------+
From: David Van Hoose 14-Oct-99 10:30:00
To: All 14-Oct-99 15:24:10
Subj: GetGetInfoBlocks
Does anyone here know if there is a Linux version
of DosGetInfoBlocks()?
-Dave
--- PCBoard (R) v15.4 (OS/2) 250 Beta
* Origin: Destiny BBS: 1-850-477-1262 (1:3612/333)
900/525
+----------------------------------------------------------------------------+
From: MIKE RUSKAI 14-Oct-99 19:29:00
To: ALL 15-Oct-99 01:07:19
Subj: DosDevIOCtl, cat8, f64
I'm collecting information on the size of the HPFS directory band, with
respect to the size of the drive. To do this, I read the Super Block by
opening the drive as a file.
This fails, however, with drives over 2GB in size, since DosRead() and
cousins can't handle files that size (except perhaps on Aurora - I had one
person run it successfully on a 14GB drive, and am awaiting information on
what he's running).
To get around this, I figure I need to make a call to DosDevIOCtl(),
category 8 (IOCTL_DISK), function 0x64 (DSK_READTRACK).
The problem is that part of the parameters are the drive head and cylinder.
How do I figure out which head and cylinder I need to read from? This
isn't a physical disk category, so I don't see why the head and cylinder
are there in the first place.
I managed to get the function to run (it seems very sensitive to invalid
parameters, even when they appear quite valid), using 0 for the head and
cylinder values. What I get back, however, is data that doesn't appear to
be on the drive at all.
Can anyone shed some light on this?
Mike Ruskai
thannymeister@yahoo.com
... And the sound we make together is the music to the story in your eyes.
___ Blue Wave/QWK v2.20
--- Platinum Xpress/Win/Wildcat5! v3.0pr2
* Origin: FIDO QWK MAIL & MORE! WWW.DOCSPLACE.ORG (1:3603/140)
900/525
+----------------------------------------------------------------------------+
From: MIKE RUSKAI 14-Oct-99 19:52:00
To: ALL 15-Oct-99 01:07:19
Subj: DosDevIOCtl()
Forget that last post. The head/cylinder numbers are relative to the
beginning of the logical drive. Sort of. With head and cylinder set to 0,
you'll get X sectors of garbage before the boot sector, where X is the
number of sectors per track of the drive. Setting head to 1, and cylinder
to 0 makes sector 0 the boot sector.
Mike Ruskai
thannymeister@yahoo.com
... Are there any lawyers here? <BLAM> Any more?
___ Blue Wave/QWK v2.20
--- Platinum Xpress/Win/Wildcat5! v3.0pr2
* Origin: FIDO QWK MAIL & MORE! WWW.DOCSPLACE.ORG (1:3603/140)
900/525
+----------------------------------------------------------------------------+
From: Rob Basler 14-Oct-99 18:37:02
To: All 15-Oct-99 02:07:00
Subj: Watcom fails on WSEB
FYI Watcom C++ 11.0b's debugger does not work on OS/2 WSeB. There is
something wrong with the startup code generated by the compiler so that
a task exception (general protection fault) happens before the debugger
gets to the startup code (even before it goes to main()). It looks like
it might be failing either in the debugger or in some .DLL's
initialization. The only way to get an EXE to load into WD is to either
get rid of the .SYM file (no symbols makes for tough debugging) or use
"Debug Startup" but that traps before it gets to the start of your code.
If anyone else if affected by this, I would recommend you get to
Watcom's website, newsgroups and if your stomach can take it, tech
support ASAP since powersoft is wrapping up Watcom C++ support.
Rob.
___
X SLMR 2.1a X Summer is half the clothing, twice the fun!
--- Maximus/2 3.01
* Origin: Frog Hollow Port Moody BC 604-469-0264/0284 (1:153/290)
+----------------------------------------------------------------------------+
+============================================================================+