Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-112302

QThreadPool::start() overload taking move-only functions

    XMLWordPrintable

Details

    • c080d1e64 (dev), 0e7e1c339 (dev)

    Description

      QThreadPool::start() has an overload that takes a std::function. However, since std::function must be copyable, it's not possible to pass move-only lambdas. For example

      FileDescriptor fd{42};
      // FileDescriptor is move only
      
      QThreadPool::globalInstance()->start([fd = std::move(fd)]() mutable {
          // some work
          flush(std::move(fd)); // move the file descriptor ownership to flush()
      });
      

      Attachments

        For Gerrit Dashboard: QTBUG-112302
        # Subject Branch Project Status CR V

        Activity

          People

            allan.jensen Allan Sandfeld Jensen
            zzag Vlad Zahorodnii
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes