Thread View: comp.os.os2.programmer
3 messages
3 total messages
Started by Fan Jiao
Wed, 15 Apr 1992 19:19
CreateThread using malloc
Author: Fan Jiao
Date: Wed, 15 Apr 1992 19:19
Date: Wed, 15 Apr 1992 19:19
14 lines
901 bytes
901 bytes
I was using CreateThread call to create several threads. Before that I was using 'malloc' to create the stack which is needed as one of the parameters for 'CreateThread' call. I donot know if use of 'malloc' is proper. I also looked into the use of 'DosAllocSeg'. And I got "wrong ring level" error msg while using 'DosAllocSeg'. In short, I am confused in how to create the stack for theads. Any ideas? Thanks much in advance. -- Fan Jiao
Re: CreateThread using malloc
Author: David Charlap
Date: Thu, 16 Apr 1992 13:24
Date: Thu, 16 Apr 1992 13:24
26 lines
1614 bytes
1614 bytes
In article <jj91eqk@twilight.wpd.sgi.com> fanj@remb6489.wpd writes: >I was using CreateThread call to create several threads. Before that I was >using 'malloc' to create the stack which is needed as one of the parameters >for 'CreateThread' call. > >I donot know if use of 'malloc' is proper. I also looked into the >use of 'DosAllocSeg'. And I got "wrong ring level" error msg while using >'DosAllocSeg'. > >In short, I am confused in how to create the stack for theads. Any ideas? Can't help you there. malloc() should be fine. It maps onto a subroutine based on DosAllocSeg. About your "Wrong Ring Level", did you remember to run the macro to convert the memory HANDLE returned to the memory POINTER you probably need? (which malloc() returns) I don't know the name of the macro, but it's been posted a few times. -- David Charlap Q:"Where do these stairs go?" dic5340@hertz.njit.edu A:"They go up" ---------------------------- Hi! I am a .signature virus. Copy me into your .signature to join in!
Re: CreateThread using malloc
Author: Larry Salomon, Jr.
Date: Thu, 16 Apr 1992 21:54
Date: Thu, 16 Apr 1992 21:54
27 lines
1858 bytes
1858 bytes
In <jj91eqk@twilight.wpd.sgi.com>, fanj@remb6489.wpd.sgi.com (Fan Jiao) writes: > >I was using CreateThread call to create several threads. Before that I was >using 'malloc' to create the stack which is needed as one of the parameters >for 'CreateThread' call. I assume you mean DosCreateThread. >I donot know if use of 'malloc' is proper. I also looked into the >use of 'DosAllocSeg'. And I got "wrong ring level" error msg while using >'DosAllocSeg'. If you are writing a 16-bit application, DosAllocSeg should work. Are you passing it the proper parameters? If you are writing a 32-bit application, DosCreateThread will create the stack for you, so you don't need to do it. Cheers, Larry Salomon, Jr. (aka 'Q') LARRYS@YKTVMV.BITNET OS/2 Applications and Tools larrys@watson.ibm.com IBM T.J. Watson Research Center larrys@ibmman.watson.ibm.com Yorktown Heights, NY larrys@ibmman2.watson.ibm.com Disclaimer: The statements and/or opinions stated above are strictly my own and do not reflect the views of my employer. Additionally, I have a reputation for being obnoxious, so don't take any personal attacks too seriously.
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