opencv thread safe?

This is a discussion on opencv thread safe? within the C Programming forums, part of the General Programming Boards category; I still have to figure out: which openCV functions are pthread-safe?! By pthread-safe I mean that (1) opencv functions can ...

  1. #1
    Alessio Stella
    Join Date
    May 2008
    Location
    Italy, Bologna
    Posts
    251

    opencv thread safe?

    I still have to figure out:
    which openCV functions are pthread-safe?!

    By pthread-safe I mean that
    (1) opencv functions can be called by different threads on different
    data with no unexpected result, with no need of mutex protection. This
    imply opencv functions are fully reentrant (using only stack variables)
    (2) opencv functions can be called by different threads on the same
    data provided the ordinary use of pthread_mutex_lock()/trylock()/unlock
    ()/etc.

    A specific example: what to do if I wanna call cvGetTickCount() by
    different threads? Do I have to use mutexes??!! (that would spoil the
    measure)

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,555
    Doesn't the manual page tell you?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Alessio Stella
    Join Date
    May 2008
    Location
    Italy, Bologna
    Posts
    251
    Quote Originally Posted by Salem View Post
    Doesn't the manual page tell you?
    strangely enough I do not think it does

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,555
    In the absense of
    a) the manual telling you that it's thread safe
    b) you reading the source code to determine if it's thread safe,

    Then it's best to assume that it isn't thread safe at all.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. thread safe in Dispose method
    By George2 in forum C# Programming
    Replies: 3
    Last Post: 05-15-2008, 07:32 AM
  2. thread safe in my code to manipulate List?
    By George2 in forum C# Programming
    Replies: 8
    Last Post: 05-01-2008, 06:57 AM
  3. are winsock functions thread safe?
    By *DEAD* in forum Networking/Device Communication
    Replies: 2
    Last Post: 12-15-2007, 09:37 AM
  4. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 08:56 AM
  5. C++ Threading?
    By draggy in forum C++ Programming
    Replies: 5
    Last Post: 08-16-2005, 12:16 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21