Thread View: comp.os.os2.programmer
5 messages
5 total messages
Started by Christophe Wolfhugel
Thu, 16 May 1991 15:32
Multi-threaded appl & printf
Author: Christophe Wolfhugel
Date: Thu, 16 May 1991 15:32
Date: Thu, 16 May 1991 15:32
15 lines
1149 bytes
1149 bytes
Is following correct (OS/2 1.2EE / IBM C/2 1.1): The main thread of an application creates a second thread (with DosCreateThread) that uses printf to display some text. The .obj file is linked to llibcmt & doscalls. Looking at IBM's examples this is supposed to be correct, but the stack overflow (R6000) I get on execution does not agree with this. So, who's right? Any suggestion? -- Christophe Wolfhugel (on irc: Zolf) | Email: wolf@grasp1.univ-lyon1.fr INSA Lyon - Departement Informatique | "Ecole publique, ecole fauchee. Encore" 69621 Villeurbanne Cedex | "une tradition francaise dont on se" France | "passerait bien."
Re: Multi-threaded appl & printf
Author: Alan Ballard
Date: Thu, 16 May 1991 18:37
Date: Thu, 16 May 1991 18:37
16 lines
1314 bytes
1314 bytes
In article <1991May16.153241.11420@grasp1.univ-lyon1.fr> wolf@grasp1.univ-lyon1.fr (Christophe Wolfhugel) writes: >Is following correct (OS/2 1.2EE / IBM C/2 1.1): > >The main thread of an application creates a second thread (with >DosCreateThread) that uses printf to display some text. The .obj >file is linked to llibcmt & doscalls. Hard to know without seeing the source. Are you sure you are setting up the stack for DosCreateThread correctly? Are you compiling with the right memory model for llibcmt? -- Alan Ballard | Internet: ballard@ucs.ubc.ca University Computing Services | Bitnet: USERAB1@UBCMTSG University of British Columbia | Phone: 604-822-3074 Vancouver B.C. Canada V6R 1Z2 | Fax: 604-822-5116
Re: Multi-threaded appl & printf
Author: Wim Bonner
Date: Fri, 17 May 1991 04:52
Date: Fri, 17 May 1991 04:52
19 lines
1341 bytes
1341 bytes
In article <1991May16.153241.11420@grasp1.univ-lyon1.fr> wolf@grasp1.univ-lyon1.fr (Christophe Wolfhugel) writes: >Is following correct (OS/2 1.2EE / IBM C/2 1.1): > >The main thread of an application creates a second thread (with >DosCreateThread) that uses printf to display some text. The .obj >file is linked to llibcmt & doscalls. Are you using MSC 6.0? If so, instead of using DosCreateThread, use the MS Call _beginthread which is designed so that it will allow the things in the C Runtime Library to work correctly. I had a similar problem and it took me some time to figure out, and mostly because of the backwards way the MSC Manuals are arranged. Wim. -- | wbonner@yoda.eecs.wsu.edu | The Loft BBS | 27313853@wsuvm1.csc.wsu.edu | (509)335-4339 | 72561.3135@CompuServe.com | USR HST Dual Standard HST/V.32
Re: Multi-threaded appl & printf
Author: Christian Zahl
Date: Fri, 17 May 1991 23:12
Date: Fri, 17 May 1991 23:12
15 lines
1122 bytes
1122 bytes
(article lost?!) The problem is explained in the handbooks (Language Reference, Compile Link..). There are some funktions in the libraries, in which the stackcheck is fix included. One of these is the printf function. The full list is included in the manuals. One way out of this desaster is to patch this funktion by extracting from the library with LIB, patching with DEBUG, and replacing with LIB). The other possiblity is to use sprintf and VioWrtTTY instead. hope it helps.. ------------------------------------------------------------------------------- Christian Zahl - pure student ! Technische Universitaet Berlin, Germany
Re: Multi-threaded appl & printf
Author: Peter GOLDE
Date: Tue, 21 May 1991 05:36
Date: Tue, 21 May 1991 05:36
14 lines
1245 bytes
1245 bytes
>In article <1991May16.153241.11420@grasp1.univ-lyon1.fr> wolf@grasp1.univ-lyon1.fr (Christophe Wolfhugel) writes: >>Is following correct (OS/2 1.2EE / IBM C/2 1.1): >> >>The main thread of an application creates a second thread (with >>DosCreateThread) that uses printf to display some text. The .obj >>file is linked to llibcmt & doscalls. If the C/2 libraries are like the MS-C libraries (and I think they are very close), you need to call _beginthread to start the thread rather than DosCreateThread. _beginthread initializes some per-thread static data (stuff like errno), which also includes the stack size used by the stack checking routine. Calling DosCreateThread directly will result in problems like what you are seeing.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads