Thr_create() returns -1 which isn't specified in the man page. What is -1?

Hello,
I'm for the first time experimenting with Solaris threads as I'm porting an AIX app. over to Solaris.
Anyhow, I have a sample program that creates a simple thread. For some reason, the return value of of the initial thr_create is -1, which isn't specified in the man page for thr_create. The man page lists the following return values, non of which are -1:
RETURN VALUES
Zero indicates a successful return and a non-zero value
indicates an error.
ERRORS
If any of the following conditions occur, these functions
fail and return the corresponding value:
EAGAIN The system-imposed limit on the total number
of threads in a process has been exceeded or
some system resource has been exceeded (for
example, too many LWPs were created).
EINVAL The value specified by attr is invalid.
If any of the following conditions are detected,
pthread_create() fails and returns the corresponding value:
ENOMEM Not enough memory was available to create the
new thread.
If any of the following conditions are detected,
thr_create() fails and returns the corresponding value:
EINVAL o stack_base is not NULL and stack_size is
less than the value returned by
thr_min_stack(3T).
o stack_base is NULL and stack_size is not
zero and is less than the value returned by
thr_min_stack(3T).
However, I don't see a -1 there and therefore, don't know what this means.
Here is the simple code that I wrote for this experiment as well as the output. It doesn't get too far into the program before exiting - I've bolded where it exits:
#define _REENTRANT
#include <stdio.h>
#include <thread.h>
#include <errno.h>
/* Function prototypes for thread routines */
void sub_a(void );
void sub_b(void );
void sub_c(void );
void sub_d(void );
void sub_e(void );
void sub_f(void );
thread_t thr_a, thr_b, thr_c;
void main()
thread_t main_thr;
int rc = 0;
main_thr = thr_self();
printf("Main thread = %d\n", main_thr);
if (rc = thr_create(NULL, 0, sub_b, NULL, THR_NEW_LWP, &thr_b))
printf("\n rc = %d",rc);
switch(rc)
case EAGAIN: printf("This one1");
break;
case EINVAL: printf("This one2");
break;
case ENOMEM: printf("This one3");
break;
default: printf("rc = %d");
break;
fprintf(stderr,"Can't create thr_b\n"),
* exit(1); *
/* if (thr_create(NULL, 0, sub_a, (void *)thr_b, THR_NEW_LWP, &thr_a))
fprintf(stderr,"Can't create thr_a\n"), exit(1); */
if (thr_create(NULL, 0, sub_c, (void *)main_thr, THR_NEW_LWP, &thr_c))
fprintf(stderr,"Can't create thr_c\n"), exit(1);
printf("Main Created threads A:%d B:%d C:%d\n", thr_a, thr_b, thr_c);
printf("Main Thread exiting...\n");
thr_exit((void *)main_thr);
void sub_a(void arg)
thread_t thr_b = (thread_t) arg;
thread_t thr_d;
int i;
printf("A: In thread A...\n");
if (thr_create(NULL, 0, sub_d, (void *)thr_b, THR_NEW_LWP, &thr_d))
fprintf(stderr, "Can't create thr_d\n"), exit(1);
printf("A: Created thread D:%d\n", thr_d);
/* process
for (i=0;i<1000000*(int)thr_self();i++);
printf("A: Thread exiting...\n");
thr_exit((void *)77);
void * sub_b(void *arg)
int i;
printf("B: In thread B...\n");
/* process
for (i=0;i<1000000*(int)thr_self();i++);
printf("B: Thread exiting...\n");
thr_exit((void *)66);
void * sub_c(void *arg)
void *status;
int i;
thread_t main_thr, ret_thr;
main_thr = (thread_t)arg;
printf("C: In thread C...\n");
if (thr_create(NULL, 0, sub_f, (void *)0, THR_BOUND|THR_DAEMON, NULL))
fprintf(stderr, "Can't create thr_f\n"), exit(1);
printf("C: Join main thread\n");
if (thr_join(main_thr,(thread_t *)&ret_thr, &status))
fprintf(stderr, "thr_join Error\n"), exit(1);
printf("C: Main thread (%d) returned thread (%d) w/status %d\n", main_thr, ret_thr, (int) status);
/* process
for (i=0;i<1000000*(int)thr_self();i++);
printf("C: Thread exiting...\n");
thr_exit((void *)88);
void * sub_d(void *arg)
thread_t thr_b = (thread_t) arg;
int i;
thread_t thr_e, ret_thr;
void *status;
printf("D: In thread D...\n");
if (thr_create(NULL, 0, sub_e, NULL, THR_NEW_LWP, &thr_e))
fprintf(stderr,"Can't create thr_e\n"), exit(1);
printf("D: Created thread E:%d\n", thr_e);
printf("D: Continue B thread = %d\n", thr_b);
thr_continue(thr_b);
printf("D: Join E thread\n");
if(thr_join(thr_e,(thread_t *)&ret_thr, &status))
fprintf(stderr,"thr_join Error\n"), exit(1);
printf("D: E thread (%d) returned thread (%d) w/status %d\n", thr_e,
ret_thr, (int) status);
/* process
for (i=0;i<1000000*(int)thr_self();i++);
printf("D: Thread exiting...\n");
thr_exit((void *)55);
void * sub_e(void *arg)
int i;
thread_t ret_thr;
void *status;
printf("E: In thread E...\n");
printf("E: Join A thread\n");
if(thr_join(thr_a,(thread_t *)&ret_thr, &status))
fprintf(stderr,"thr_join Error\n"), exit(1);
printf("E: A thread (%d) returned thread (%d) w/status %d\n", ret_thr, ret_thr, (int) status);
printf("E: Join B thread\n");
if(thr_join(thr_b,(thread_t *)&ret_thr, &status))
fprintf(stderr,"thr_join Error\n"), exit(1);
printf("E: B thread (%d) returned thread (%d) w/status %d\n", thr_b, ret_thr, (int) status);
printf("E: Join C thread\n");
if(thr_join(thr_c,(thread_t *)&ret_thr, &status))
fprintf(stderr,"thr_join Error\n"), exit(1);
printf("E: C thread (%d) returned thread (%d) w/status %d\n", thr_c, ret_thr, (int) status);
for (i=0;i<1000000*(int)thr_self();i++);
printf("E: Thread exiting...\n");
thr_exit((void *)44);
void sub_f(void arg)
int i;
printf("F: In thread F...\n");
while (1) {
for (i=0;i<10000000;i++);
printf("F: Thread F is still running...\n");
OUTPUT:
# /emc/smithr15/solthread
Main thread = 1
rc = -1Can't create thr_b
rc = -1#
Any ideas as to what -1 indicates and how to solve this?
Thanks for your response,
dedham_ma_man

ok, my bad. I wasn't linking in the -lthread library.
Thanks anyway.

Similar Messages

  • I'm on a prepaid plan for the 4s, i want the hotspot option which isn't offered on the prepaid plan.  heard the connection is too slow on the 4s only worth it on the 5 or 5s. would you agree? not sure how much the hotspot would increase my monthly bill...

    i'm on a prepaid plan for the 4s, i want the hotspot option which isn't offered on the prepaid plan.  heard the connection is too slow on the 4s only worth it on the 5 or 5s. would you agree? not sure how much the hotspot would increase my monthly bill....

    To use the hotspot for any of those devices, I believe you have to switch to a postpaid account and plan. You can see the pricing for the available postpaid plans under the "Shop" area of the website.

  • I just downloaded Itunes to my new computer, and when I tried to go to the Store, it says the info I requested isn't available in the US. What gives?

    I just downloaded Itunes to my new computer, and when I tried to go to the Store, it says the info I requested isn't available in the US. What gives?

    Make sure you have the latest version of iTunes, which is available here -> http://www.apple.com/itunes/download/
    Then try following the steps in this Apple article to create an account without a credit card -> Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card

  • My macbook pro recently got swiped and I lost all my data, problem is, just before it was swiped I set up my new iphone 5 which transferred all my photos and music over which is no longer on the computer. What will happen to my phone if I plug it in?

    My macbook pro recently got swiped and I lost all my data, problem is, just before it was swiped I set up my new iphone 5 which transferred all my photos and music over which is no longer on the computer. What will happen to my phone if I plug it in?

    I never used icloud before so there is no data to back up from. I just spoke  to the apple store and they said that if I do plug it in, all the data will be swiped....is there a program I can use to transfer my data from my phone to computer without loosing it all ???
    Renee

  • HT201210 the ipod could not be updated. this device isn't eligible for the requested build. what is this? what to do to update my iPod

    the ipod could not be updated. this device isn't eligible for the requested build. what is this? what to do to update my iPod ?

    This device is not eligible for the requested build (Also sometimes displayed as an "error 3194")
    Update to the latest version of iTunes. Mac OS X 10.5.8 (Leopard) users may need to download iTunes 10.6.3.
    Third-party security software or router security settings can also cause this issue. To resolve this, followTroubleshooting security software issues.
    Downgrading to a previous version of iOS is not supported. If you have installed software to performunauthorized modifications to your iOS device, that software may have redirected connections to the update server (gs.apple.com) within the Hosts file. Uninstall the unauthorized modification software from the computer.
    Edit out the "gs.apple.com" redirect from your hosts file, and then restart the computer for the host file changes to take affect. For steps to edit the Hosts file and allow iTunes to communicate with the update server, see iTunes: Advanced iTunes Store troubleshooting—follow steps under the heading Blocked by configuration (Mac OS X / Windows) > Rebuild network information > Mac OS X > The hosts file may also be blocking the iTunes Store. If you do not uninstall the unauthorized modification software prior to editing the hosts file, that software may automatically modify the hosts file again on restart.
    Avoid using an older or modified .ipsw file. Try moving the current .ipsw file (see Advanced Steps > Rename, move, or delete the iOS software file (.ipsw) below for file locations), or try restoring in a new user to ensure that iTunes downloads a new .ipsw.

  • HT4623 when i doing my update my ipad 3 why the itunes show this message ? (the ipad could not be restored this device isn't eligible for the requested guid ) what can i do now please reply urgent thanks

    when i doing my update my ipad 3 why the itunes show this message ? (the ipad could not be restored this device isn't eligible for the requested guid ) what can i do now please reply urgent thanks

    Make sure you have the latest software on your computer (tap to enlarge image)

  • I have a 2nd generation ipod, but can't load any new games because they require a newer version of software (which isn't available on the 2nd gen

    Hello, I have a 2nd Gen Ipod Touch and can't get any new games to load (because the 2nd generatiom requires new software, which isn't available). Is there a way to get older versions of games to load on the ipod?
    Thanks

    To more easily find compatible apps:
    iOSSearch - search the iTunes store for compatible apps.
    Apple Club - filter apps by iOS version.
    Starting when iOS 7 was releases, Apple now allows downloading the last compatible version of some apps (iOS 4.2.1 and later only)
    App Store: Downloading Older Versions of Apps on iOS - Apple Club
    App Store: Install the latest compatible version of an app
    You first have to download the non-compatible version on your computer. Then when you try to purchase the version on your iPod you will be offered a compatible version if one exists.

  • How to create a field in an OAF page which sums two fields in the same page.

    Hi,
    In the HRMS appraisal page, I have two fields in different regions.
    1. One field shows the total score of the competencies.
    2. Another field shows the total scores of the objectives.
    The problem with the appraisal total score is it returns only the rating level id. (It does not take decimal values)
    Hence I want to add the above two fields which is displayed in the same page and show as a new field in the top of the page as the final appraisal score.
    [Something similar to what is mentioned in the metalink document 1315431.1 ]
    We are in 11.5.10.2.
    I am new to OAF and have no idea as to how to achieve the above step. Can anyone guide me in doing it?
    regards

    Hi,
    Went through the steps to do a VO substitution.
    But normally in all the examples given the page will belong to the application where we are modifying.
    Eg. in this case the "about this page" shows /oracle/apps/fnd/wf/worklist/webui/NotifDetailsPG
    This is coming under fnd top where all the appraisal VOs and other pages comes under PER_TOP.
    Should I bring all the files from FND_TOP of the server to my PC where jdev is installed.
    I have already taken all the files under $PER_TOP to my PC.
    regards

  • Report is returning data which isn't there.

    I have a simple report pulling data from one table. I went through and deleted the information and I am still having 2 rows show up, where I KNOW there is no data.
    I've gone through SQL developer and copy/pasted the query and I get nothing returned. I've refreshed everything, down to the computer level and even restarted since I first saw this problem, and I am still getting the same 2 rows displayed.
    ANy idea whats going on??

    well I just did this and I have no idea why some of the data showed as deleted and these two still existed. I deleted them in one fell swoop, deleting by the date they were added, all yesterday. Thanks for that pointer though, amazing it was somehting that simple :)
    If I am to include a "delete" button on an APEX app which deletes rows, would I want a commit command inside that button also, or does it automatically get processed?

  • [b]Need to access a file which is not specified in the classpath[/b]

    Hi everybody ,
    I need your help to proceed with my application. I've tried accessing a file without setting it in Classpath using getResourceAsStream(..), but i'm getting an error.
    error :
    java.lang.NullPointerException
    at java.io.Reader.<init>(Reader.java:61)
    at java.io.InputStreamReader.<init>(InputStreamReader.java:55)
    at abc.func(LoadProp.java:13)
    at LoadProp.main(LoadProp.java:35)
    Application :-
    import java.io.* ;
    class test
    public void func(String file )
    String thisLine ;
    try
    InputStream is = test.class.getClassLoader().getResourceAsStream(file);
    System.out.println("File load successful");
    BufferedReader myInput = new BufferedReader(new InputStreamReader(is));
    while ((thisLine = myInput.readLine()) != null) {
    System.out.println(thisLine);
    catch (Exception e)
    System.out.println("Inside Catch");
    e.printStackTrace();
    public class LoadProp
    public static void main(String args[])
    String testname = System.getProperty("propfile");
    System.out.println(testname);
    test t = new test() ;
    t.func(testname) ;
    System.out.println("End Main!") ;
    Output:-
    test.properties
    File load successful
    Inside Catch
    java.lang.NullPointerException
    at java.io.Reader.<init>(Reader.java:61)
    at java.io.InputStreamReader.<init>(InputStreamReader.java:55)
    at test.func(LoadProp.java:13)
    at LoadProp.main(LoadProp.java:35)
    End Main!
    Anyone of you help me to get rid of this problem..
    Thanks & Regards
    BK

    It has to be in the classpath for getResourceAsStream
    to "get" it.So if your question is really about needing to read a file which is not in the classpath and won't be, then as long as you have the path to that file, just use FileInputStream to read it.
    InputStream is = new FileInputStream(pathToFileHere);

  • I'm running 5.0.1 which isn't compatible with the website used by my graduate studies program. In lieu of switching to IE 9 to access this site, is there any way to gain access to Firefox 4.0?

    The website used by my graduate studies program doesn't yet support Firefox 5.0. In lieu of switching browsers, I would like to get an older version of Firefox (4.0) to support my studies.
    Thanks.

    You can install the portable Firefox 3.6.19 version to access websites that do not work with Firefox 5+.
    *http://portableapps.com/apps/internet/firefox_portable#legacy
    *http://portableapps.com/apps/internet/firefox_portable/localization#legacy36

  • Which log file will give the info about what is missing in sales document

    Hello SAP gurus
    I am trying to send a quote from our application to get saved in SAP using .Net Connector. I get the following error messages
    S  V4   233  SALES_HEADER_IN has been processed successfully
    S   V4  233  SALES_ITEM_IN has been processed successfully
    W  V1  555  The sales document is not yet complete: Edit data
    I am looking for any kind of incompletion log that will give more info about what is missing etc.,
    Where can I find such a log. Your feedback will be greatly appreciated.
    Tks
    Ram

    Hi,
    Just check this path.
    Go to sales order->Edit->Incompletion log.
    This  tells your docuement status. If at all your document is incomplete,you can just see what all you are missing.
    Thanks
    KV

  • After a security update I get the log on screen for a site which I use which then immediately reverts to the starting page of the site without a chance to log on

    The site in question had no problems until the security update.
    If I log on using Firefox 3 there are also no problems.

    Hi:
    Just had a similar problem.
    (And I think the solution might apply to Leopard Server as well as client versions of Tiger and Leopard.)
    Last night, I applied the 2009-001 security update to our PPC Tiger Server. I did it via a download from Software Update, controlling the server's screen remotely from home via ARD.
    Upon restart, I could not longer see or control the server via ARD, but the mail server was still working. ssh prompted me for passwords, but wouldn't let me connect.
    So I came to the office this morning and found a blue screen and a spinning wheel cursor.
    I tried a number of things, including:
    --Starting in safe mode (it wouldn't)
    --Single user mode and running fsck
    --Repairing permissions using Disk Utility (via a start-up CD)
    --Repairing the disk using Disk Utility (via a start-up CD)
    --Resetting the PRAM
    --Disconnecting peripherals
    Then I saw a tip on-line somewhere and reinstalled the security update in the following manner:
    --Download the update from Apple's downloads page on CPU-matching hardware (that is, a PowerPC Mac.)
    --Connect via FireWire Target Disk mode.
    --Double-click the installation package and install it on the server's hard drive. (This didn't work the first time I tried installing from an Intel Mac.)
    --Restart.
    And the server restarted and away we go.
    I've got some mail server issues to repair (it appears), but at least it's running again.
    I have not tried restarting again to see what happens.
    mm

  • HT5624 Anytime I use my apple Id I am asked to review it and this always what I go through which does not even solve the problem. What do I do?

    What is review of apple id?

    Hi there,
    This may be happening if you have not used this Apple ID in the iTunes store before. Take a look at the article below for more information.
    Using an existing Apple ID with the iTunes Store and Mac App Store
    http://support.apple.com/kb/HT2589
    -Griff W.

  • My numbers spreadsheet isn't flowing to the next page.

    And sometimes when I paste it (formula results only), it gets locked on the page above and I can't move it.

    Dave,
    Made sure your table is set to Arrange > Move with text.
    Jerry

Maybe you are looking for

  • Why can't I drag a photo from iPhoto to a folder?

    You guys - I used to be able to drag photos from iPhoto to pretty much wherever I wanted.  I'm currently trying to drag them to a folder, but it doesn't work. I tried to email them to myself, THEN drag them into said folder, still doesn't work. I had

  • Can changes be made to page numbers?

    I have been using light room now for about a month and do think everything is getting easier.  I maintain my own website and use the web catalogs for preview photos of the auction every week.  I will frequently ad pages to the catalog every week. On

  • Airport no longer connects

    Airport on my PowerBook doesn't connect. It was previously connecting to my Belkin Pre-N which quit again, and is again on it's way back to Belkin for repair. In the mean time, I've been connecting it to my iMac's airport through a shared connection,

  • How to find out who was the previous owner of an iPad?

    My sister has recently found an iPad 1 WiFi on a bus. To determine the actual owner she had a friend to reset the iPad to factory settings (not sure why though) and now all initial data is lost. Apple Store could not help much, as the iPad was sold b

  • TextEdit css files auto open in Dreamweaver all of a sudden - How can I stop this?

    I'm on a Macbook Pro, OS X.  Whenever I open a TextEdit css file lately, it auto opens in Dreamweaver.  I've never used or saved anything to Dreamweaver so I don't know why this is happening.  It hadn't in the past.  I need to use TextEdit specifical