SCTP Discussions

Text archives Help


Re: [SCTP-Discussion] a weird bug (segmentation fault)


Chronological Thread 
  • From: "Julio Kriger" <juliokriger AT gmail.com>
  • To: "Thomas Dreibholz" <dreibh AT iem.uni-due.de>
  • Cc: discussion AT sctp.de
  • Subject: Re: [SCTP-Discussion] a weird bug (segmentation fault)
  • Date: Tue May 23 19:52:03 2006
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=CM53WDIWRxk8ICrYGb4m+iurEm/ZcagqtBXanRQoy1pqUTSuovacK5IH68YDi/T+f9IgCWklDpaO+3TehXFdOKkQlpCWqZlu1swK4IBpf99fyIAis7Rok51C7/QzUYmsp+AwkPM11jFHbNsRAmixdT+OEDAIbT7mhcsifw2E4Z4=
  • List-id: SCTP Discussions <discussion.sctp.de>

Hi Thomas,
  Thanks for the details. I never knew about "sctp_extendedEventLoop(lock
,unlock,mutex);". I will follow you advice.
  Regards,
Julio


On 5/23/06, Thomas Dreibholz <dreibh AT iem.uni-due.de> wrote:
On Tuesday 23 May 2006 14:38, Julio Kriger wrote:
> Hi!
>   I didn't knew that the library is not thread safe.
>   So to fix my app, I should put a mutex before where the calling of
> "sctp_*" functions (for example put a mutex before SCTP_receive, SCTP_send,
> ect) ? and what about SCTP_startTimer? should I put a mutex before calling
> that function?
>   Well, let say that I should put a mutex before calling any function from
> the SCTP library. That should fix the thread-safe problem.

Yes, make sure that every sctplib function is called exclusively.

For the event loop, the following das to be done: define functions to obtain
and release the mutex and give a pointer to the mutex as third argument:

void lock(void* mutexPtr)
{
   mutex = (YourMutexPtrType*)mutexPtr;
   Lock it ...
}

void unlock(void* mutexPtr)
{
   mutex = (YourMutexPtrType*)mutexPtr;
   Unlock it ...
}

sctp_extendedEventLoop(lock,unlock,mutex);


Also have a look into the file sctpsocketmaster.cc of the socket API. It
implements the thread-safe event loop for the socket API library.


Best regards
--
=======================================================================
Dipl.-Inform. Thomas Dreibholz

University of Essen,                            Room ES210
Inst. for Experimental Mathematics              Ellernstraße 29
Computer Networking Technology Group            D-45326 Essen/Germany
-----------------------------------------------------------------------
E-Mail:     dreibh AT exp-math.uni-essen.de
Homepage:   http://www.exp-math.uni-essen.de/~dreibh
=======================================================================





--
--
Stewie: [After Lois tries to feed Stewie his broccoli "airplane style"] Damn you, Damn the Broccoli, and Damn the Wright Brothers.
----------------------------
Julio Kriger
mailto:juliokriger AT gmail.com



Archive powered by MHonArc 2.6.19+.

Top of page