Skip to content

Poco::Thread tryJoin linux/windows different behavior #5016

@micheleselea

Description

@micheleselea

Hi all, I really don't know how to classify this, I write it down just to let you know and try to save some debug time.
I found a different behavior in tryJoin posix version and windows version.
Probably it's not a common use and probably a fix will break some compatibility or portability, that is:

Poco::Thread t;
t.startFunc([]{});

WINDOWS:
bool ret1 = t.tryJoin(1000) ; return true
bool ret2 = t.tryJoin(1000) ; return true

LINUX:
bool ret1 = t.tryJoin(1000) ; return true
bool ret2 = t.tryJoin(1000) ; return false

this because _pData->started it's never set to false after join, it's only set to true in start function
Probably the correct behavior is to do like windows style but I understand can be a breaking change even if probably it's not a problem in most application, just be careful if you rely on return code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions