Welcome, Guest. Please login or register.

Author Topic: CreateNewProc bug in SASC ?  (Read 5593 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2871
    • Show all replies
CreateNewProc bug in SASC ?
« on: August 19, 2007, 12:56:26 PM »
Hi. I've shrinked a bug to the tiny piece of code bellow. Works well when compiled with VBCC but crashes on my bare A1200 with SASC ?!
Code: [Select]

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <utility/tagitem.h>
#include <exec/ports.h>
#include <dos/dos.h>
#include <dos/dostags.h>

/* Protos */
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
#include <clib/alib_protos.h>

void CllFnc(void);

int main (int argc, char **argv)
{ struct Process *Proc;
  struct TagItem PrcTgs[5];
  PrcTgs[0].ti_Tag = NP_Entry;
  PrcTgs[0].ti_Data = (ULONG)CllFnc;
  PrcTgs[1].ti_Tag = NP_Name;
  PrcTgs[1].ti_Data = (ULONG)&quot;TestProcessName&quot;;
  PrcTgs[2].ti_Tag = NP_Output;
  PrcTgs[2].ti_Data = Output();
  PrcTgs[3].ti_Tag = NP_CloseOutput;
  PrcTgs[3].ti_Data = FALSE;
  PrcTgs[4].ti_Tag = TAG_DONE;
 
  if (!(Proc = CreateNewProc(PrcTgs)))
    printf(&quot;Thread creation error!!!\n&quot;);
  else
    printf(&quot;Thread creation successfull\n&quot;);

Delay(200); /* Wait 4 seconds. Normally a WaitPort or Wait should be used, */
exit(0); /* but this is just a shrinked piece of code to reproduce the bug */
}


/* Function caller */
void CllFnc(void)
{ Forbid();
  printf(&quot;Test text working!!!\n&quot;);
}

\\"We made Amiga, they {bleep}ed it up\\"
 

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2871
    • Show all replies
Re: CreateNewProc bug in SASC ?
« Reply #1 on: August 19, 2007, 10:54:54 PM »
It must be what Thomas suggested, I just moved this piece of code from VBCC to SASC to be able to use it's debugger and kept most of the default options.

As for stdio not being thread safe. I've debugged various multithreaded functions in the past and worst result I've had AFAIremember was the text output being mixed up, but no crashes.

Cheers for the replies
\\"We made Amiga, they {bleep}ed it up\\"
 

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2871
    • Show all replies
Re: CreateNewProc bug in SASC ?
« Reply #2 on: September 27, 2007, 08:20:41 PM »
@Einstein

Never messed with it, but I think names are irrelevant...
\\"We made Amiga, they {bleep}ed it up\\"